A112545 Least odd number k greater than 1 such that the sum of the predecessor and successor primes of the n-th prime is divisible by k or if no such odd k exists then 2.
7, 5, 2, 5, 7, 2, 5, 3, 3, 3, 3, 5, 11, 3, 53, 3, 3, 3, 5, 3, 3, 3, 3, 5, 5, 13, 53, 5, 59, 61, 3, 3, 11, 5, 3, 157, 3, 3, 173, 3, 5, 11, 97, 7, 3, 211, 3, 113, 5, 3, 3, 5, 3, 257, 263, 3, 3, 3, 5, 7, 5, 151, 5, 157, 7, 3, 3, 7, 5, 3, 3, 3, 373, 3, 3, 3, 5, 13, 5, 5, 5, 7, 3, 3, 3, 3, 5, 5, 29, 3, 3
Offset: 2
Keywords
Links
- Robert Israel, Table of n, a(n) for n = 2..10000
Crossrefs
Programs
-
Maple
f:= proc(n) local t; t:= min(numtheory:-factorset(ithprime(n-1)+ithprime(n+1)) minus {2}); if t::integer then t else 2 fi end proc: map(f, [$2..200]); # Robert Israel, Apr 20 2017
-
Mathematica
f[n_] := Block[{k = 3, s = Prime[n - 1] + Prime[n + 1]}, While[Mod[s, k] != 0 && k <= s, k += 2]; If[k > s, 2, k]]; Table[ f[n], {n, 2, 92}]
-
PARI
a(n) = {p = prime(n); s = precprime(p-1) + nextprime(p+1); f = factor(s); if (#f~ > 1, f[2,1], f[1,1]);} \\ Michel Marcus, Apr 22 2017
Comments