login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A066868
a(n) is the least k such that n + Sum_{i=1..k} A005385(i) is prime; or 0 if none exists.
0
2, 1, 10, 5, 2, 1, 2, 1, 12, 5, 2, 1, 4, 1, 4, 5, 2, 1, 2, 3, 4, 7, 12, 1, 2, 1, 4, 7, 2, 3, 2, 1, 4, 5, 2, 1, 4, 1, 6, 17, 2, 1, 4, 3, 6, 5, 2, 1, 2, 3, 4, 11, 12, 1, 2, 1, 4, 5, 2, 3, 2, 1, 4, 5, 14, 1, 2, 1, 10, 5, 2, 7, 10, 1, 6, 7, 2, 1, 8, 3, 4, 7, 26, 1
OFFSET
1,1
COMMENTS
Conjecture: a(n) is nonzero for all n, so every n can be represented as the difference between a prime and a partial sum of the safe primes series. See A066753 for a similar conjecture.
EXAMPLE
4 + (5 + 7 + 11 + 23 + 47) = 97, a prime and 5 consecutive safe primes, starting from the first safe prime 5, are needed to achieve this. Hence a(4) = 5.
PROG
(PARI) a(n) = my(p=3, s=n); for(k=1, oo, until(isprime((p-1)/2), p=nextprime(p+1)); if(isprime(s+=p), return(k))); \\ Jinyuan Wang, Jul 30 2020
CROSSREFS
Sequence in context: A126450 A235608 A112333 * A193900 A319373 A143172
KEYWORD
nonn,less
AUTHOR
Joseph L. Pe, Jan 21 2002
EXTENSIONS
Offset changed to 1 by Jinyuan Wang, Jul 30 2020
STATUS
approved