login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A022898 Number of solutions to c(1)*prime(2)+...+c(n)*prime(n+1) = 1, where c(i) = +-1 for i>1, c(1) = 1. 1
0, 0, 1, 0, 0, 0, 3, 0, 2, 0, 14, 0, 40, 0, 97, 0, 323, 0, 1252, 0, 3808, 0, 14298, 0, 46256, 0, 171281, 0, 591786, 0, 2158580, 0, 7725607, 0, 27804271, 0, 99859607, 0, 368197850, 0, 1352006460, 0, 4981076329, 0, 18492738212, 0, 68481571926, 0, 254616154516, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,7

LINKS

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

EXAMPLE

a(7) counts these 3 solutions: {3, -5, 7, 11, -13, 17, -19}, {3, 5, -7, -11, 13, 17, -19}, {3, 5, -7, 11, -13, -17, 19}.

MATHEMATICA

{f, s} = {2, 1}; Table[t = Map[Prime[# + f - 1] &, Range[2, z]]; Count[Map[Apply[Plus, #] &, Map[t # &, Tuples[{-1, 1}, Length[t]]]], s - Prime[f]], {z, 22}]

(* A022898, a(n) = number of solutions of "sum = s" using Prime(f) to Prime(f+n-1) *)

n = 7; t = Map[Prime[# + f - 1] &, Range[n]]; Map[#[[2]] &, Select[Map[{Apply[Plus, #], #} &, Map[t # &, Map[Prepend[#, 1] &, Tuples[{-1, 1}, Length[t] - 1]]]], #[[1]] == s &]]  (* the 3 solutions of using n=7 primes; Peter J. C. Moses, Oct 01 2013 *)

PROG

(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))) == 1, nbs++); ); nbs; } \\ Michel Marcus, Sep 30 2013

CROSSREFS

Sequence in context: A065152 A171759 A073538 * A072780 A124452 A291786

Adjacent sequences:  A022895 A022896 A022897 * A022899 A022900 A022901

KEYWORD

nonn

AUTHOR

Clark Kimberling

EXTENSIONS

Corrected and extended by Clark Kimberling, Oct 01 2013

a(23)-a(50) from Alois P. Heinz, Aug 06 2015

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 February 22 18:24 EST 2020. Contains 332148 sequences. (Running on oeis4.)