login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A261057 Number of solutions to c(1)*prime(1)+...+c(2n-1)*prime(2n-1) = -2, where c(i) = +-1 for i > 1, c(1) = 1. 19
0, 0, 1, 1, 5, 13, 40, 123, 388, 1284, 4332, 14868, 51094, 178361, 634422, 2260717, 8066841, 29030051, 105247340, 383574146, 1404657053, 5171018981, 19140750300, 71124341227, 263546155710, 983417309702, 3684399940711, 13818092760075, 51937827473594, 195956606402526 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,5

COMMENTS

There cannot be a solution for an even number of terms on the l.h.s. because there would be an odd number of odd terms but the r.h.s. is even.

LINKS

Alois P. Heinz, Table of n, a(n) for n = 1..300

FORMULA

a(n) = A113041(n) - A022896(2n-1).

EXAMPLE

a(1) = a(2) = 0 because prime(1) and prime(1) +- prime(2) +- prime(3) is always different from -2.

a(3) = 1 because prime(1) - prime(2) - prime(3) - prime(4) + prime(5) = -2.

MAPLE

s:= proc(n) option remember;

      `if`(n<2, 0, ithprime(n)+s(n-1))

    end:

b:= proc(n, i) option remember; `if`(n>s(i), 0, `if`(i=1, 1,

      b(abs(n-ithprime(i)), i-1)+b(n+ithprime(i), i-1)))

    end:

a:= n-> b(4, 2*n-1):

seq(a(n), n=1..30);  # Alois P. Heinz, Aug 08 2015

MATHEMATICA

s[n_] := s[n] = If[n<2, 0, Prime[n]+s[n-1]]; b[n_, i_] := b[n, i] = If[n > s[i], 0, If[i == 1, 1, b[Abs[n-Prime[i]], i-1] + b[n+Prime[i], i-1]]]; a[n_] := b[4, 2*n-1];  Table[a[n], {n, 1, 30}] (* Jean-Fran├žois Alcover, Nov 11 2015, after Alois P. Heinz *)

PROG

(PARI) A261057(n, rhs=-2, firstprime=1)={rhs-=prime(firstprime); my(p=vector(2*n-2+bittest(rhs, 0), 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 >> 10.

(PARI) a(n, s=-2-prime(1), p=1)={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), max(sum(i=p+1, p+=2*n-2+bittest(s, 0), prime(i)), 1), prime(p))))} \\ M. F. Hasler, Aug 09 2015

CROSSREFS

Cf. A261059, A261060, A261045 (starting with prime(2) - prime(4)), A261061 - A261063 and A261044 (r.h.s. = -1), A022894 - A022904, A083309, A022920 (r.h.s. = 0, 1 or 2); A113040, A113041, A113042.

Sequence in context: A272585 A026069 A054856 * A283456 A121872 A228922

Adjacent sequences:  A261054 A261055 A261056 * A261058 A261059 A261060

KEYWORD

nonn

AUTHOR

M. F. Hasler, Aug 08 2015

EXTENSIONS

a(26)-a(30) from Alois P. Heinz, Jan 04 2019

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 16 08:53 EDT 2019. Contains 327092 sequences. (Running on oeis4.)