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.

A022897 Number of solutions to c(1)*prime(2) +...+ c(n)*prime(n+1) = 0, where c(i) = +-1 for i > 1, c(1) = 1.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 2, 0, 7, 0, 19, 0, 63, 0, 197, 0, 645, 0, 2172, 0, 7423, 0, 25534, 0, 89218, 0, 317284, 0, 1130526, 0, 4033648, 0, 14515742, 0, 52625952, 0, 191790090, 0, 702333340, 0, 2585539586, 0, 9570549372, 0, 35562602950, 0, 131774529663, 0
Offset: 1

Views

Author

Keywords

Examples

			a(8) counts these 2 solutions: {3, 5, -7, 11, 13, 17, -19, -23}, {3, 5, 7, 11, -13, -17, -19, 23}. - _Clark Kimberling_, Oct 01 2013
		

Crossrefs

Cf. A083309 (without odd n).
Cf. A022894 (use all primes in the sum), A022895 (r.h.s. = 1), A022896 (r.h.s. = 2),..., A022903 (using primes >= 7), A022904, A022920; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060, A261044 (r.h.s. = -2).

Programs

  • Mathematica
    Table[ps = Prime[Range[2, n+1]]; pr = Inner[Times, 2 IntegerDigits[Range[2^(n-1), 2^n - 1], 2, n] - 1, ps, Plus]; Count[pr, 0], {n, 16}] (* T. D. Noe, Sep 30 2013 *)
  • PARI
    padbin(n, len) = {if (n, b = binary(n), b = [0]); while(length(b) < len, b = concat(0, b);); b;}
    a(n) = {nbs = 0; for (i = 2^(n-1), 2^n-1, vec = padbin(i, n); if (sum(k=1, n, if (vec[k], prime(k+1), -prime(k+1))) == 0, nbs++);); nbs;} \\ Michel Marcus, Sep 30 2013
    
  • PARI
    A022897(n, rhs=0, firstprime=2)={rhs-=prime(firstprime); my(p=vector(n-1, i, prime(i+firstprime))); sum(i=1, 2^#p-1, sum(j=1, #p, (-1)^bittest(i, j-1)*p[j])==rhs)} \\ For illustrative purpose, too slow for n >> 20. - M. F. Hasler, Aug 08 2015
    
  • PARI
    a(n, s=0-3, p=2)=if(n<=s, if(s==p, n==s, a(abs(n-p), s-p, precprime(p-1))+a(n+p, s-p, precprime(p-1))), if(s<=0, a(abs(s), sum(i=p+1, p+n-1, prime(i)), prime(p+n-1)))) \\ M. F. Hasler, Aug 09 2015

Formula

a(2n-1) = 0 (odd number of odd terms on the l.h.s.); a(2n) = A083309(n). - M. F. Hasler, Aug 08 2015
a(n) = [x^3] Product_{k=3..n+1} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 26 2024

Extensions

a(20)-a(24) from Michel Marcus, Sep 30 2013
More terms from T. D. Noe, Sep 30 2013