login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A045985 a(n) = least k such that sum of first k primes is n times a prime. 2

%I #23 Nov 01 2023 09:57:57

%S 1,3,10,5,3,123,8,15,20,147,8,97,92,5,414,27,120,739,144,9,86,69,858,

%T 99,62,61,26,33,7,57,456,11,76,13,180,207,58,23,166,17,38,339,10,693,

%U 242,23,1162,169,440,9,374,117,682,187,1284,683,70,281,48

%N a(n) = least k such that sum of first k primes is n times a prime.

%H Reinhard Zumkeller, <a href="/A045985/b045985.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)

%e a(3) = 10 because the partial sum of the first 10 primes is 3*43 = 129.

%t a[n_] := Catch[For[p=0; sp=0; k=1, True, k++, p = NextPrime[p]; sp = sp+p; If[PrimeQ[sp/n], Throw[k]]]]; Table[a[n], {n, 1, 59}] (* _Jean-François Alcover_, Nov 13 2012 *)

%t Module[{nn=1500,p,t},p=Accumulate[Prime[Range[nn]]];t=Thread[{Range[ nn],p}];Table[SelectFirst[t,PrimeQ[ #[[2]]/n]&],{n,60}]][[All,1]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Mar 16 2020 *)

%o (Haskell)

%o a045985 n = head [k | (k, x) <- zip [1..] a007504_list,

%o let (y, r) = divMod x n, r == 0, a010051' y == 1]

%o -- _Reinhard Zumkeller_, Oct 05 2015

%Y Cf. A007504, A010051, A053050.

%K nice,nonn

%O 1,2

%A _Felice Russo_

%E More terms from _David W. Wilson_

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 12:53 EDT 2024. Contains 371969 sequences. (Running on oeis4.)