A114409 Length of all-prime chain of prime[n] + successive even pentagonal numbers.
1, 2, 3, 2, 1, 2, 4, 1, 2, 4, 1, 2, 1, 2, 1, 2, 4, 4, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 4, 1, 2, 2, 1, 3, 1, 1, 2, 1, 2, 2, 1, 1, 1, 2, 4, 1, 2, 3, 1, 2, 1, 2, 2, 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 3, 1, 1, 1, 2, 4, 1, 4, 2, 4, 2, 1, 1, 1, 2, 1
Offset: 2
Examples
a(2) = 1 because prime(2) = 3 is prime, but prime(2) + EvenPent(1) = 3 + 12 = 15 = 3 * 5 is nonprime, giving a chain of just 1 successive prime. a(3) = 2 because 5 is prime, prime(3) + EvenPent(1) = 5 + 12 = 17 is prime, but prime(3) + EvenPent(2) = 5 + 22 = 27 = 3^3 is nonprime, giving a chain of 2 successive primes. a(4) = 3 because 7 is prime, 7+12 = 19 is prime, 7+22 = 29 is prime, but 7+70 = 77 = 7*11 is nonprime, for a chain of 3 successive primes.
Programs
-
Mathematica
evp = Select[#*(3*# - 1)/2 &@ Range[200], EvenQ]; a[n_] := Block[{s = Prime@n, c = 1}, While[PrimeQ[s + evp[[c]]], c++]; c]; a /@ Range[2, 90] (* Giovanni Resta, Jun 14 2016 *)
Formula
Extensions
Corrected and extended by Giovanni Resta, Jun 14 2016
Comments