A114383 Length of all-prime chain of prime(n) + successive even triangular numbers.
1, 2, 3, 2, 4, 2, 1, 2, 1, 9, 3, 2, 1, 2, 2, 1, 12, 2, 1, 8, 1, 2, 1, 3, 2, 5, 2, 1, 1, 1, 2, 1, 1, 1, 2, 3, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 4, 2, 1, 2, 1, 1, 2, 2, 2, 1, 3, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 6, 1, 2, 1, 1, 1, 1, 1, 1, 1, 4, 1, 2, 1
Offset: 2
Examples
a(2) = 1 because prime(2) = 3 is prime, but prime(2) + EvenTriangular(1) = 3 + 6 = 9 = 3^2 is nonprime, giving a chain of just 1 successive prime. a(3) = 2 because prime(3) + EvenTriangular(1) = 5 + 6 = 11 is prime, but prime(3) + EvenTriangular(2) = 5 + 10 = 15 = 3*5 is nonprime, giving a chain of 2 successive primes. a(4) = 3 because 7 is prime, 7+6 = 13 is prime, 7+10 = 17 is prime, but 7+28 = 35 = 5*7 is nonprime, for a chain of 3 successive primes. a(6) = 4 because 13 is prime, 13+6 = 19 is prime, 13+10 = 23 is prime, 13+28 = 41 is prime, but 13+36 = 49 = 7^2 is nonprime. a(11) = 9 because 31 is prime, as is 31+6 = 37; 31+10 = 41; 31+28 = 59; 31+36 = 67; 31+66 = 97; 31+78 = 109; 31+120 = 151; 31+136 = 167; but 31+190 = 221 = 13*17 is nonprime. a(18) = 11 because of the prime chain 61; 61+6 = 67; 61+10 = 71; 61+28 = 89; 61+36 = 97; 61+66 = 127; 61+78 = 139; 61+120 = 181; 61+136= 197; 61+190 = 251; 61+276 = 337; but 61+300 = 361 = 19^2 is nonprime.
Links
- Robert Israel, Table of n, a(n) for n = 2..10000
Programs
-
Maple
f:= proc(n) local p,k,j,count; p:= ithprime(n); count:= -1; for k from 0 do for j in [0,3] do count:= count+1; if not isprime (p + 1/2*(4*k+j)*(4*k+j+1)) then return count fi; od od end proc: map(f, [$2..100]); # Robert Israel, Jun 14 2016
-
Mathematica
evt = Select[(# + 1) #/2 &@Range[200], EvenQ]; a[n_] := Block[{s = Prime@n, c = 1}, While[PrimeQ[s + evt[[c]]], c++]; c]; a /@ Range[2, 90] (* Giovanni Resta, Jun 14 2016 *)
Formula
Extensions
Corrected and extended by Giovanni Resta, Jun 14 2016
Comments