A274995 a(n) is the smallest odd prime that divides (-n) + the sum of all smaller primes, or 0 if no such prime exists.
5, 19, 3, 7, 82811, 3, 11, 17, 3, 191, 5, 3, 37, 29, 3, 5, 69431799799, 3, 1105589, 28463, 3, 431, 2947308589, 3, 7, 5, 3, 59, 11, 3, 5, 7, 3, 41
Offset: 0
Examples
a(1) = 19 because 19 is the smallest odd prime that divides the sum of (-1) + (sum of all primes smaller than itself), that is, -1 + 58 = 57. a(7) = 17 because -7 + 2 + 3 + 5 + 7 + 11 + 13 + 17 = 49 and 49/7 = 7.
Links
- Robert G. Wilson v, n and a(n), or 0 if no such value is known, for n=0..10000
Programs
-
Mathematica
f[n_] := Block[{p = 3, s = 2 - n}, While[ Mod[s, p] != 0, s = s + p; p = NextPrime@ p]; p]; Array[f, 16, 0] (* Robert G. Wilson v, Nov 15 2016 *)
-
PARI
sump(n) = s = 0; forprime(p=2, n-1, s+=p); s; a(n) = {my(p=3); while ((sump(p)-n) % p, p = nextprime(p+1)); p;} \\ Michel Marcus, Nov 12 2016
-
PARI
a(n)=my(s=2); forprime(p=3,, if((s-n)%p==0, return(p)); s+=p) \\ Charles R Greathouse IV, Nov 15 2016
Extensions
a(16)-a(33) from Charles R Greathouse IV, Nov 15 2016
Comments