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.

A066956 a(n) is the number of ways of placing '+' and '-' among the digits 123456789 so that the result of the expression is n, '-' before 1 not allowed.

This page as a plain text file.
%I A066956 #16 Nov 26 2021 10:38:11
%S A066956 11,26,11,18,8,21,12,17,8,22,12,21,11,16,15,20,8,17,11,20,15,16,11,23,
%T A066956 18,13,14,21,15,19,17,14,19,19,7,14,19,19,17,18,16,17,18,10,15,26,18,
%U A066956 15,16,12,17,19,9,17,21,16,13,14,16,17,17,11,13,22,14,13,15,15,15,17,7
%N A066956 a(n) is the number of ways of placing '+' and '-' among the digits 123456789 so that the result of the expression is n, '-' before 1 not allowed.
%C A066956 a(n) = 0 for all but finitely many n. In particular, a(n) = 0 for n > 123456789. - _Charles R Greathouse IV_, Aug 20 2012
%H A066956 Alois P. Heinz, <a href="/A066956/b066956.txt">Table of n, a(n) for n = 0..34668</a>
%e A066956 a(4) = 8 because 4 = 12-34-56-7+89 = 12-3-4-5-6-7+8+9 = 12-3+45-67+8+9 = 12-3+4-5+6+7-8-9 = 12-3+4+5-6-7+8-9 = 12+3-4-5+6-7+8-9 = 12+3-4+5-6-7-8+9 = 1+2-34+5+6+7+8+9 and only for these.
%o A066956 (Python)
%o A066956 from collections import Counter
%o A066956 from itertools import product, zip_longest
%o A066956 def aupton(nn):
%o A066956     digs = list("123456789")
%o A066956     c = Counter(eval("".join(filter(None, sum(zip_longest(digs, ops), ())))) for ops in product(["-", "+", ""], repeat=8))
%o A066956     return [c[k] for k in range(nn+1)]
%o A066956 print(aupton(70)) # _Michael S. Branicky_, Nov 26 2021
%Y A066956 Cf. A066957.
%K A066956 nice,nonn,base
%O A066956 0,1
%A A066956 Miklos SZABO (mike(AT)ludens.elte.hu), Feb 01 2002