login
A215221
Number of solutions to p(n) = Sum_{i=1..n-1} c(i)*p(i) with c(i) in {-1,0,1} and p(n) = n-th prime.
2
0, 0, 1, 1, 1, 5, 11, 28, 69, 164, 437, 1104, 2887, 7778, 20861, 55610, 148857, 408694, 1112103, 3059571, 8519916, 23586160, 65766961, 183122954, 508287720, 1423807763, 4019399991, 11359914488, 32294035715, 91866217942, 258134484981, 732226048291
OFFSET
1,6
LINKS
Alois P. Heinz and Ray Chandler, Table of n, a(n) for n = 1..1000 (first 200 terms from Alois P. Heinz)
FORMULA
a(n) = A215222(A000040(n)).
EXAMPLE
a(3) = 1: prime(3) = 5 = 3+2.
a(4) = 1: prime(4) = 7 = 5+2.
a(5) = 1: prime(5) = 11 = 7+5-3+2.
a(6) = 5: prime(6) = 13 = 7+5+3-2 = 11+2 = 11+5-3 = 11+7-3-2 = 11+7-5.
a(7) = 11: prime(7) = 17 = 7+5+3+2 = 11+5+3-2 = 11+7-3+2 = 13+5-3+2 = 13+7-3 = 13+7-5+2 = 13-11+7+5+3 = 13+11-5-2 = 13+11-7 = 13+11-7-5+3+2 = 13+11-7+5-3-2.
MAPLE
sp:= proc(n) option remember; `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1,
b(n, i-1)+ b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
end:
a:= n-> b(ithprime(n), n-1):
seq(a(n), n=1..40);
MATHEMATICA
nmax = 40; d = {1}; a1 = {};
Do[
p = Prime[n];
i = Ceiling[Length[d]/2] + p;
AppendTo[a1, If[i > Length[d], 0, d[[i]]]];
d = PadLeft[d, Length[d] + 2 p] + PadRight[d, Length[d] + 2 p] +
PadLeft[PadRight[d, Length[d] + p], Length[d] + 2 p];
, {n, nmax}];
a1 (* Ray Chandler, Mar 11 2014 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 06 2012
STATUS
approved