OFFSET
1,2
LINKS
G. C. Greubel, Rows n = 1..100 of triangle, flattened
EXAMPLE
Triangle starts:
1;
2, 1;
4, 5, 1;
8, 19, 10, 1;
16, 65, 69, 17, 1;
32, 211, 410, 188, 28, 1;
MAPLE
T:=proc(n, k): if n=1 and k=1 then 1 elif k<1 or k>n then 0 else ithprime(k)*T(n-1, k)+T(n-1, k-1) fi end: for n from 1 to 11 do seq(T(n, k), k=1..n) od; # yields sequence in triangular form
MATHEMATICA
T[n_, k_]:= T[n, k]= If[n==1 && k==1 , 1, If[k<1 || k>n, 0, Prime[k]*T[n-1, k] + T[n-1, k-1] ]]; Table[T[n, k], {n, 12}, {k, n}]//Flatten (* G. C. Greubel, Nov 19 2019 *)
PROG
(PARI) T(n, k) = if(n==1 && k==1, 1, if(k<1 || k>n, 0, prime(k)*T(n-1, k) + T(n-1, k-1) )); \\ G. C. Greubel, Nov 19 2019
(Magma)
function T(n, k)
if k lt 1 or k gt n then return 0;
elif n eq 1 and k eq 1 then return 1;
else return NthPrime(k)*T(n-1, k) + T(n-1, k-1);
end if;
return T;
end function;
[T(n, k): k in [1..n], n in [1..12]]; // G. C. Greubel, Nov 19 2019
(Sage)
@CachedFunction
def T(n, k):
if (k<1 or k>n): return 0
elif (n==1 and k==1): return 1
else: return nth_prime(k)*T(n-1, k) + T(n-1, k-1)
[[T(n, k) for k in (1..n)] for n in (1..12)] # G. C. Greubel, Nov 19 2019
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Gary W. Adamson, Nov 13 2006
EXTENSIONS
Edited by N. J. A. Sloane, Nov 29 2006
STATUS
approved