login
Numbers k for which 6 divides prime(k)-prime(j) for some j<k; each k occurs once for each such j.
8

%I #8 Mar 30 2012 18:58:11

%S 5,6,7,7,8,8,9,9,9,10,10,10,10,11,11,11,12,12,12,12,13,13,13,13,13,14,

%T 14,14,14,14,15,15,15,15,15,15,16,16,16,16,16,16,16,17,17,17,17,17,17,

%U 17,17,18,18,18,18,18,18,19,19,19,19,19,19,19,20,20,20,20,20

%N Numbers k for which 6 divides prime(k)-prime(j) for some j<k; each k occurs once for each such j.

%C For a guide to related sequences, see A205558.

%e The first six terms match these differences:

%e p(5)-p(3)=11-5=6=6*1

%e p(6)-p(4)=13-7=6=6*1

%e p(7)-p(3)=17-5=12=6*2

%e p(7)-p(5)=17-11=6=6*1

%e p(8)-p(4)=19-7=12=6*2

%e p(8)-p(6)=19-13=6=6*1

%t s[n_] := s[n] = Prime[n]; z1 = 400; z2 = 80;

%t f[n_] := f[n] = Floor[(-1 + Sqrt[8 n - 7])/2];

%t Table[s[n], {n, 1, 30}] (* A000040 *)

%t u[m_] := u[m] = Flatten[Table[s[k] - s[j], {k, 2, z1}, {j, 1, k - 1}]][[m]]

%t Table[u[m], {m, 1, z1}] (* A204890 *)

%t v[n_, h_] := v[n, h] = If[IntegerQ[u[h]/n], h, 0]

%t w[n_] := w[n] = Table[v[n, h], {h, 1, z1}]

%t d[n_] := d[n] = Delete[w[n], Position[w[n], 0]]

%t c = 6; t = d[c] (* A205690 *)

%t k[n_] := k[n] = Floor[(3 + Sqrt[8 t[[n]] - 1])/2]

%t j[n_] := j[n] = t[[n]] - f[t][[n]] (f[t[[n]]] + 1)/2

%t Table[k[n], {n, 1, z2}] (* A205691 *)

%t Table[j[n], {n, 1, z2}] (* A205692 *)

%t Table[s[k[n]], {n, 1, z2}] (* A205693 *)

%t Table[s[j[n]], {n, 1, z2}] (* A205694 *)

%t Table[s[k[n]] - s[j[n]], {n, 1, z2}] (* A205695 *)

%t Table[(s[k[n]] - s[j[n]])/c, {n, 1, z2}] (* A205696 *)

%Y Cf. A205558, A204892, A204890, A205695, A205696.

%K nonn

%O 1,1

%A _Clark Kimberling_, Jan 31 2012