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!)
A327467 a(n) = smallest k such that n can be expressed as a signed sum of the first k primes. 2
3, 2, 1, 4, 3, 2, 3, 4, 5, 6, 3, 4, 5, 4, 5, 6, 7, 4, 5, 6, 7, 6, 5, 6, 5, 6, 7, 6, 5, 8, 7, 6, 7, 8, 7, 6, 7, 6, 7, 8, 7, 6, 7, 8, 7, 8, 9, 8, 7, 8, 9, 8, 7, 8, 7, 8, 9, 8, 7, 8, 9, 8, 9, 8, 9, 10, 9, 8, 9, 10, 9, 8, 9, 8, 9, 10, 9, 8, 9, 10, 9, 10, 9, 10, 9, 10 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

COMMENTS

Smallest k such that n = +- p_1 +- p_2 +- p_3 +- ... +- p_k for a suitable choice of signs, where p_i = i-th prime.

REFERENCES

Allan C. Wechsler, Posting to Sequence Fans Mailing List, circa Aug 29 2019.

LINKS

Seiichi Manyama, Table of n, a(n) for n = 0..10000 (terms 0..1000 from Giovanni Resta)

FORMULA

a(A007504(n)) = n for n > 0. - Seiichi Manyama, Sep 30 2019

EXAMPLE

Illustration of initial terms:

0  =   2 + 3 - 5

1  = - 2 + 3

2  =   2

3  = - 2 + 3 - 5 + 7

4  =   2 - 3 + 5

5  =   2 + 3

6  = - 2 + 3 + 5

7  =   2 + 3 - 5 + 7

8  =   2 - 3 + 5 - 7 + 11

9  =   2 - 3 + 5 + 7 + 11 - 13

10 =   2 + 3 + 5

...

MATHEMATICA

(* 1001 terms *) sgn[w_] := Union@ Abs[Total /@ (w # & /@ Tuples[{1, -1}, Length@w])]; set[n_] := Block[{h = Floor[n/2], p = Prime@ Range@ n, x, y}, x = sgn[Take[p, h]]; y = sgn[Take[p, h - n]]; Union@ Flatten@ Table[{e + f, Abs[e - f]}, {e, x}, {f, y}]]; T = {}; L = 0 Range[1001]; k = 0; While[Length[T] < 1001, k++; s = Select[set[k], # <= 1000 && ! MemberQ[T, #] &]; Do[L[[e + 1]] = k, {e, s}]; T = Union[T, s]]; L (* Giovanni Resta, Sep 30 2019 *)

CROSSREFS

Cf. A007504, A140358.

Sequence in context: A190704 A190698 A283183 * A077427 A107641 A299352

Adjacent sequences:  A327464 A327465 A327466 * A327468 A327469 A327470

KEYWORD

nonn

AUTHOR

N. J. A. Sloane, Sep 29 2019

EXTENSIONS

More terms from Giovanni Resta, Sep 30 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 June 2 18:15 EDT 2020. Contains 334787 sequences. (Running on oeis4.)