login
Triangle where a(0,0) = 1; a(n,m) = number of terms in row (n-1) which, when added to m, are primes.
4

%I #16 Sep 09 2017 03:56:16

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

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

%U 3,7,2,3,3,4,3,7,2,3,11,3,5,3,9,2,4,1,5,3,9,2,4,8,5,9,4,6,2,4,2,8,4,6,2,4,2

%N Triangle where a(0,0) = 1; a(n,m) = number of terms in row (n-1) which, when added to m, are primes.

%H Michael De Vlieger, <a href="/A114920/b114920.txt">Table of n, a(n) for n = 0..11627</a> (rows 0 <= n <= 150).

%e Row 3 of the triangle is [1,2,2,2]. Adding 0 to these gives [1,2,2,2], of which 3 terms are primes. Adding 1 to these gives [2,3,3,3], of which 4 terms are primes. Adding 2 to these gives [3,4,4,4], of which one term is prime. Adding 3 to these gives [4,5,5,5], of which 3 terms are primes. Adding 4 to these gives [5,6,6,6], of which one term is prime. So row 4 is [3,4,1,3,1].

%e Triangle begins:

%e 1;

%e 0, 1;

%e 0, 1, 2;

%e 1, 2, 2, 2;

%e 3, 4, 1, 3, 1;

%e 2, 3, 4, 1, 4, 0;

%e 2, 4, 3, 4, 2, 2, 1;

%e ...

%t NestList[Function[w, Map[Function[k, Count[Map[k + # &, w], _?PrimeQ]], Range[0, Length@ w]]], {1}, 13] // Flatten (* _Michael De Vlieger_, Sep 07 2017 *)

%o (PARI) {v=[1]; for(k=1,20,w=vector(length(v)+1);for(i=0,length(v), for(j=1,length(v),if(isprime(v[j]+i),w[i+1]++)));v=w;print(v))} \\ Lambert Herrgesell(zero815(AT)googlemail.com), Jan 13 2006

%Y Cf. A114919, A114905, A114906.

%K nonn,tabl

%O 0,6

%A _Leroy Quet_, Jan 07 2006

%E More terms from Lambert Herrgesell (zero815(AT)googlemail.com), Jan 13 2006