login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A124960
Triangle read by rows: T(n,k) = p(k)*T(n-1,k) + T(n-1,k-1) (1 <= k <= n), where p(k) denotes the k-th prime.
4
1, 2, 1, 4, 5, 1, 8, 19, 10, 1, 16, 65, 69, 17, 1, 32, 211, 410, 188, 28, 1, 64, 665, 2261, 1726, 496, 41, 1, 128, 2059, 11970, 14343, 7182, 1029, 58, 1, 256, 6305, 61909, 112371, 93345, 20559, 2015, 77, 1, 512, 19171, 315850, 848506, 1139166, 360612, 54814, 3478, 100, 1
OFFSET
1,2
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
T(2n,n) gives A332967 (for n>0).
Sequence in context: A126182 A154342 A143494 * A137346 A264017 A159971
KEYWORD
nonn,tabl
AUTHOR
Gary W. Adamson, Nov 13 2006
EXTENSIONS
Edited by N. J. A. Sloane, Nov 29 2006
STATUS
approved