cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Nov 13 2006

Keywords

Examples

			Triangle starts:
   1;
   2,   1;
   4,   5,   1;
   8,  19,  10,   1;
  16,  65,  69,  17,  1;
  32, 211, 410, 188, 28, 1;
		

Crossrefs

T(2n,n) gives A332967 (for n>0).

Programs

  • 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
    
  • 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 *)
  • 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
    
  • 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

Extensions

Edited by N. J. A. Sloane, Nov 29 2006