login
Triangle read by rows in which the j-th row begins with prime(j) and is the arithmetic progression with least common difference such that the remaining j-1 terms are composite and not divisible by prime(j).
3

%I #7 Sep 26 2017 10:21:23

%S 2,3,4,5,16,27,7,8,9,10,11,18,25,32,39,13,24,35,46,57,68,17,64,111,

%T 158,205,252,299,19,44,69,94,119,144,169,194,23,40,57,74,91,108,125,

%U 142,159,29,81,133,185,237,289,341,393,445,497,31,54,77,100,123,146,169,192,215

%N Triangle read by rows in which the j-th row begins with prime(j) and is the arithmetic progression with least common difference such that the remaining j-1 terms are composite and not divisible by prime(j).

%e 2

%e 3 4

%e 5 16 27

%e 7 8 9 10

%e 11 18 25 32 39

%e 13 24 35 46 57 68

%t row[n_] := For[r = 1, True, r++, ro = Table[Prime[n] + k*r, {k, 0, n-1}]; If[AllTrue[Rest[ro], CompositeQ[#] && !Divisible[#, Prime[n]]&], Return[ro] ] ]; Table[row[n], {n, 1, 11}] // Flatten (* _Jean-François Alcover_, Sep 26 2017 *)

%o (PARI) {check(p,j,a)=local(b,k);b=1;k=1;while(b&&k<j,x=p+a*k;if(isprime(x)||x%p==0,b=0,k++));b}

%o {arithprog(p,j)=local(a);a=1;while(!check(p,j,a),a++);a}

%o {m=11;for(j=1,m,p=prime(j);d=arithprog(p,j);for(k=1,j,print1(p+d*(k-1),",")))}

%Y Cf. A095182.

%Y Row sums are in A160915. [From _Klaus Brockhaus_, May 30 2009]

%K nonn,tabl

%O 1,1

%A _Amarnath Murthy_, Jun 02 2004

%E Edited and extended by _Klaus Brockhaus_, Jun 03 2004