cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A338551 Number of ways to make a checkout score of n in darts.

Original entry on oeis.org

0, 1, 1, 4, 7, 14, 20, 31, 39, 55, 65, 86, 96, 126, 133, 171, 179, 223, 228, 286, 283, 352, 348, 422, 408, 497, 467, 569, 534, 642, 594, 720, 654, 791, 719, 863, 775, 942, 831, 1012, 894, 1082, 945, 1159, 991, 1216, 1037, 1263, 1062, 1311, 1081, 1340, 1110, 1366
Offset: 1

Views

Author

Carmen Bruni, Nov 02 2020

Keywords

Comments

In other words, the number of ways to achieve a score of n using at most 3 darts and finishing on a double. The maximum checkout score is 170, so this is a finite sequence.

Crossrefs

Programs

  • PARI
    seq()={my(s=x*(1-x^20)/(1-x)+x^25, d=subst(s,x,x^2), g=s+d+subst(s-x^25,x,x^3)); Vecrev((1+g+g^2)*d/x)} \\ Andrew Howroyd, Nov 04 2020
  • Python
    def darts(n):
      if n > 170 or n <= 1:
        return 0
      ans = 0
      singles = list(range(1, 21)) + [25]
      doubles = list(map(lambda x: 2*x, singles))
      triples = list(map(lambda x: 3*x, singles[:-1]))
      throws = singles+doubles+triples
      for i in range(len(throws)):
        for j in range(len(throws)):
          for k in range(len(doubles)):
            dart1 = throws[i]
            dart2 = throws[j]
            dart3 = doubles[k]
            if dart1 + dart2 + dart3 == n:
              ans += 1
        for j in range(len(doubles)):
          dart1 = throws[i]
          dart2 = doubles[j]
          if dart1 + dart2 == n:
            ans += 1
      return ans + (n in doubles)
    for i in range(1,171):
      print(darts(i))