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.

A127648 Triangle read by rows: row n consists of n zeros followed by n+1.

Original entry on oeis.org

1, 0, 2, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15
Offset: 0

Views

Author

Gary W. Adamson, Jan 22 2007

Keywords

Comments

Alternatively, a(n) = k if n+1 is the k-th triangular number and 0 otherwise.
Triangle T(n,k), 0<=k<=n, read by rows, given by (0,0,0,0,0,0,0,0,0,0,...) DELTA (2,-1/2,1/2,0,0,0,0,0,0,0,...) where DELTA is the operator defined in A084938. - Philippe Deléham, Oct 27 2011

Examples

			First few rows of the triangle:
  1;
  0, 2;
  0, 0, 3;
  0, 0, 0, 4;
  0, 0, 0, 0, 5;
  0, 0, 0, 0, 0, 6;
  0, 0, 0, 0, 0, 0, 7;
  ...
		

Crossrefs

Programs

  • Haskell
    a127648 n k = a127648_tabl !! n !! k
    a127648_row n = a127648_tabl !! n
    a127648_tabl = map reverse $ iterate (\(x:xs) -> x + 1 : 0 : xs) [1]
    a127648_list = concat a127648_tabl
    -- Reinhard Zumkeller, Jul 13 2013
    
  • Magma
    [k eq n select n+1 else 0: k in [0..n], n in [0..20]]; // G. C. Greubel, Mar 12 2024
    
  • Maple
    A127648 := proc(n)
        for i from 0 do
            if A000217(i) = n+1 then
                return i ;
            elif A000217(i) >n then
                return 0 ;
            end if;
        end do;
    end proc: # R. J. Mathar, Apr 23 2013
  • Mathematica
    Flatten[Table[{n,Table[0,{n}]},{n,15}]] (* Harvey P. Dale, Jul 27 2011 *)
  • PARI
    A127648(n) = if(ispolygonal(1+n,3), (sqrtint(1+((1+n)*8))-1)/2, 0); \\ Antti Karttunen, Jan 19 2025
  • Python
    for i in range(1,15):
        print(i, end=", ")
        for j in range(i):
            print("0", end=", ") # Mohammad Saleh Dinparvar, May 11 2020
    
  • Python
    from math import isqrt
    from sympy.ntheory.primetest import is_square
    def A127648(n): return (m:=isqrt(k:=n<<1))+(k>m*(m+1)) if is_square((n<<3)+1) else 0 # Chai Wah Wu, Jun 09 2025
    
  • SageMath
    def A127648(n): return (sqrt(9+8*n)-1)//2 if ((sqrt(9+8*n)-3)/2).is_integer() else 0
    [A127648(n) for n in range(153)] # G. C. Greubel, Mar 12 2024
    

Formula

Infinite lower triangular matrix with (1, 2, 3, ...) in the main diagonal and the rest zeros.
This sequence * A007318 (Pascal's Triangle) = A003506.
A007318 * this sequence = A103406.
G.f.: 1/(x*y-1)^2. - R. J. Mathar, Aug 11 2015
a(n) = (1/2) (round(sqrt(4 + 2 n)) - round(sqrt(2 + 2 n))) (-1 + round(sqrt(2 + 2 n)) + round(sqrt(4 + 2 n))). - Brian Tenneson, Jan 27 2017
From G. C. Greubel, Mar 13 2024: (Start)
T(n, n) = n+1.
Sum_{k=0..n} T(n, k) = n+1.
Sum_{k=0..n} (-1)^k*T(n, k) = (-1)^n*(n+1).
Sum_{k=0..floor(n/2)} T(n-k, k) = A142150(n+2).
Sum_{k=0..floor(n/2)} (-1)^k*T(n-k, k) = (-1)^floor(n/2)*A142150(n+2). (End)