[go: up one dir, main page]

login
Irregular triangle read by rows: T(n,k) = number of times a gap of k occurs between the first n successive primes.
2

%I #14 Nov 17 2016 05:19:25

%S 1,1,1,1,2,1,2,0,1,1,3,0,1,1,3,0,2,1,4,0,2,1,4,0,3,1,4,0,3,0,1,1,5,0,

%T 3,0,1,1,5,0,3,0,2,1,5,0,4,0,2,1,6,0,4,0,2,1,6,0,5,0,2,1,6,0,5,0,3,1,

%U 6,0,5,0,4,1,7,0,5,0,4,1,7,0,5,0,5,1,7,0,6,0,5,1,8,0,6,0,5,1,8,0,6,0,6,1,8,0,7,0,6,1,8,0,7,0,7,1,8,0,7,0,7,0,1,1,8,0,8,0,7,0,1,1,9,0

%N Irregular triangle read by rows: T(n,k) = number of times a gap of k occurs between the first n successive primes.

%H Robert Israel, <a href="/A277729/b277729.txt">Table of n, a(n) for n = 2..10032</a> (rows 2 to 410, flattened)

%e Triangle begins:

%e 1,

%e 1, 1,

%e 1, 2,

%e 1, 2, 0, 1,

%e 1, 3, 0, 1, <- gaps in 2,3,5,7,11,13 are 1, 2 (3 times), 4 (once)

%e 1, 3, 0, 2,

%e 1, 4, 0, 2,

%e 1, 4, 0, 3,

%e 1, 4, 0, 3, 0, 1,

%e 1, 5, 0, 3, 0, 1,

%e 1, 5, 0, 3, 0, 2,

%e 1, 5, 0, 4, 0, 2,

%e 1, 6, 0, 4, 0, 2,

%e 1, 6, 0, 5, 0, 2,

%e 1, 6, 0, 5, 0, 3,

%e 1, 6, 0, 5, 0, 4,

%e 1, 7, 0, 5, 0, 4,

%e 1, 7, 0, 5, 0, 5,

%e 1, 7, 0, 6, 0, 5,

%e 1, 8, 0, 6, 0, 5,

%e ...

%p N:= 30: # for rows 2 to N

%p res:= 1; p:= 3; R:= <1>;

%p for n from 2 to N do

%p pp:= nextprime(p);

%p d:= pp - p;

%p p:= pp;

%p if d <= LinearAlgebra:-Dimension(R) then

%p R[d]:= R[d]+1

%p else

%p R(d):= 1

%p fi;

%p res:= res, op(convert(R,list));

%p od:

%p res; # _Robert Israel_, Nov 16 2016

%Y Cf. A277730, A213930.

%K nonn,tabf

%O 2,5

%A _N. J. A. Sloane_, Nov 06 2016