login
A274995
a(n) is the smallest odd prime that divides (-n) + the sum of all smaller primes, or 0 if no such prime exists.
2
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,1
COMMENTS
From Robert G. Wilson v, Nov 15 2016: (Start)
If n == 2 (mod 3) then a(n) = 3;
If n == 0 (mod 5) then a(n) = 5;
If n == 3 (mod 7) then a(n) = 7;
If n == 6 (mod 11) then a(n) = 11;
If n == 2 (mod 13) then a(n) = 13;
If n == 7 (mod 17) then a(n) = 17;
If n == 1 (mod 19) then a(n) = 19;
If n == 8 (mod 23) then a(n) = 23;
in that order; i.e., from smaller to greater prime modulus, etc.
First occurrence of p>2: 2, 0, 3, 6, 54, 7, 1, 123, 13, 36, 12, 33, 453, 46, ..., .
(End)
The congruence classes in the above list, modulo the prime bases, namely 2, 0, 3, 6, 2, ..., are given by A071089, in which each term is the remainder when the sum of the first n primes is divided by the n-th prime. - Neil Fernandez, Nov 23 2016
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Neil Fernandez, Nov 11 2016
EXTENSIONS
a(16)-a(33) from Charles R Greathouse IV, Nov 15 2016
STATUS
approved