%I #16 Sep 07 2017 09:13:33
%S 0,0,1,1,2,1,3,2,1,2,3,2,2,2,2,4,1,4,1,4,0,5,3,4,2,1,2,4,5,3,4,2,2,2,
%T 2,2,6,2,6,1,5,1,1,2,6,8,4,2,3,5,4,3,1,2,3,5,5,5,4,3,2,2,4,5,4,3,5,6,
%U 5,2,2,4,3,6,5,2,2,4,8,4,6,1,6,3,4,4,6,1,6,3,4,10,4,5,4,5,2,8,2,5,4,5,2,8,2
%N Triangle where a(1,1) = 0; a(n,m) = number of terms in row (n-1) which, when added to m, are primes.
%H Michael De Vlieger, <a href="/A114905/b114905.txt">Table of n, a(n) for n = 1..11476</a> (rows 1 <= n <= 150).
%e The third row is [1,2,1]. Adding m=3 to these terms gives [4,5,4], of which one number is prime. Therefore a[4,3]=1 in the next row, third column.
%e Triangle starts
%e 0
%e 0 1
%e 1 2 1
%e 3 2 1 2
%e 3 2 2 2 2
%e 4 1 4 1 4 0
%e 5 3 4 2 1 2 4
%e 5 3 4 2 2 2 2 2
%e 6 2 6 1 5 1 1 2 6
%e 8 4 2 3 5 4 3 1 2 3
%p A114905 := proc(rowmax) local a,n,m,t ; a := matrix(rowmax,rowmax) ; a[1,1] := 0 ; for n from 2 to rowmax do for m from 1 to n do a[n,m] := 0 ; for t from 1 to n-1 do if isprime( m+a[n-1,t] ) then a[n,m] := a[n,m]+1 ; fi ; od ; od ; od ; RETURN(a) ; end: rowmax := 15 : a := A114905(rowmax) : for n from 1 to rowmax do for m from 1 to n do printf("%d, ",a[n,m]) ; od ; od ; # _R. J. Mathar_, Mar 13 2007
%t NestList[Function[w, Map[Function[k, Count[Map[k + # &, w], _?PrimeQ]], Range[Length@ w + 1]]], {0}, 13] // Flatten (* _Michael De Vlieger_, Sep 06 2017 *)
%Y Cf. A114906, A114919, A114920.
%K nonn,tabl
%O 1,5
%A _Leroy Quet_, Jan 06 2006
%E Corrected and extended by _R. J. Mathar_, Mar 13 2007
|