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.

A023531 a(n) = 1 if n is of the form m(m+3)/2, otherwise 0.

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
Offset: 0

Views

Author

Clark Kimberling, Jun 14 1998

Keywords

Comments

Can be read as table: a(n,m) = 1 if n = m >= 0, else 0 (unit matrix).
a(n) = number of 1's between successive 0's (see also A005614, A003589 and A007538). - Eric Angelini, Jul 06 2005
Triangle T(n,k), 0 <= k <= n, read by rows, given by A000004 DELTA A000007 where DELTA is the operator defined in A084938. - Philippe Deléham, Jan 03 2009
Sequence B is called a reverse reluctant sequence of sequence A, if B is triangle array read by rows: row number k lists first k elements of the sequence A in reverse order.
A023531 is reverse reluctant sequence of sequence A000007. - Boris Putievskiy, Jan 11 2013
Also the Bell transform (and the inverse Bell transform) of 0^n (A000007). For the definition of the Bell transform see A264428. - Peter Luschny, Jan 19 2016
This is the turn sequence of the triangle spiral. To form the spiral: go a unit step forward, turn left a(n)*120 degrees, and repeat. The triangle sides are the runs of a(n)=0 (no turn). The sequence can be generated by a morphism with a special symbol S for the start of the sequence: S -> S,1; 1 -> 0,1; 0->0. The expansion lengthens each existing side and inserts a new unit side at the start. See the Fractint L-system in the links to draw the spiral this way. - Kevin Ryde, Dec 06 2019

Examples

			As a triangle:
       1
      0 1
     0 0 1
    0 0 0 1
   0 0 0 0 1
  0 0 0 0 0 1
G.f. = 1 + x^2 + x^5 + x^9 + x^14 + x^20 + x^27 + x^35 + x^44 + x^54 + ...
From _Kevin Ryde_, Dec 06 2019: (Start)
.
              1            Triangular spiral: start at S;
             / \             go a unit step forward,
            0   0   .        turn left a(n)*120 degrees,
           /     \   .       repeat.
          0   1   0   .
         /   / \   \   \   Each side's length is 1 greater
        0   0   0   0   0    than that of the previous side.
       /   /     \   \   \
      0   0   S---1   0   0
     /   /             \   \
    0   1---0---0---0---1   0
   /                         \
  1---0---0---0---0---0---0---1
(End)
		

Crossrefs

Programs

  • Haskell
    a023531 n = a023531_list !! n
    a023531_list = concat $ iterate ([0,1] *) [1]
    instance Num a => Num [a] where
       fromInteger k = [fromInteger k]
       (p:ps) + (q:qs) = p + q : ps + qs
       ps + qs         = ps ++ qs
       (p:ps) * qs'@(q:qs) = p * q : ps * qs' + [p] * qs
        *                = []
    -- Reinhard Zumkeller, Apr 02 2011
    
  • Maple
    seq(op([0$m,1]),m=0..10); # Robert Israel, Jan 18 2015
    # alternative
    A023531 := proc(n)
        option remember ;
        local m,t ;
        for m from 0 do
            t := m*(m+3)/2 ;
            if t > n then
                return 0 ;
            elif t = n then
                return 1 ;
            end if;
        end do:
    end proc:
    seq(A023531(n),n=0..40) ; # R. J. Mathar, May 15 2025
  • Mathematica
    If[IntegerQ[(Sqrt[9+8#]-3)/2],1,0]&/@Range[0,100] (* Harvey P. Dale, Jul 27 2011 *)
    a[ n_] := If[ n < 0, 0, Boole @ IntegerQ @ Sqrt[ 8 n + 9]]; (* Michael Somos, May 17 2014 *)
    a[ n_] := SeriesCoefficient[ (EllipticTheta[ 2, 0, x^(1/2)] / (2 x^(1/8)) - 1) / x, {x, 0, n}]; (* Michael Somos, May 17 2014 *)
  • PARI
    {a(n) = if( n<0, 0, issquare(8*n + 9))}; /* Michael Somos, May 17 2014 */
    
  • PARI
    A023531(n)=issquare(8*n+9) \\ M. F. Hasler, Apr 12 2018
    
  • Python
    from math import isqrt
    def A023531(n): return int((k:=n+1<<1)==(m:=isqrt(k))*(m+1)) # Chai Wah Wu, Nov 09 2024
  • Sage
    def A023531_row(n) :
        if n == 0: return [1]
        return [0] + A023531_row(n-1)
    for n in (0..9): print(A023531_row(n))  # Peter Luschny, Jul 22 2012
    

Formula

If (floor(sqrt(2*n))-(2*n/(floor(sqrt(2*n)))) = -1, 1, 0). - Gerald Hillier, Sep 11 2005
a(n) = 1 - A023532(n); a(n) = 1 - mod(floor(((10^(n+2) - 10)/9)10^(n+1 - binomial(floor((1+sqrt(9+8n))/2), 2) - (1+floor(log((10^(n+2) - 10)/9, 10))))), 10). - Paul Barry, May 25 2004
a(n) = floor((sqrt(9+8n)-1)/2) - floor((sqrt(1+8n)-1)/2). - Paul Barry, May 25 2004
a(n) = round(sqrt(2n+3)) - round(sqrt(2n+2)). - Hieronymus Fischer, Aug 06 2007
a(n) = ceiling(2*sqrt(2n+3)) - floor(2*sqrt(2n+2)) - 1. - Hieronymus Fischer, Aug 06 2007
From Franklin T. Adams-Watters, Jun 29 2009: (Start)
G.f.: (1/2 x^{-1/8}theta_2(0,x^{1/2}) - 1)/x, where theta_2 is a Jacobi theta function.
G.f. for triangle: Sum T(n,k) x^n y^k = 1/(1-x*y). Sum T(n,k) x^n y^k / n! = Sum T(n,k) x^n y^k / k! = exp(x*y). Sum T(n,k) x^n y^k / (n! k!) = I_0(2*sqrt(x*y)), where I is the modified Bessel function of the first kind. (End)
a(n) = A000007(m), where m=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Jan 11 2013
The row polynomials are p(n,x) = x^n = (-1)^n n!Lag(n,-n,x), the normalized, associated Laguerre polynomials of order -n. As the prototypical Appell sequence with e.g.f. exp(x*y), its raising operator is R = x and lowering operator, L = d/dx, i.e., R p(n,x) = p(n+1,x), and L p(n,x) = n * p(n-1,x). - Tom Copeland, May 10 2014
a(n) = A010054(n+1) if n >= 0. - Michael Somos, May 17 2014
a(n) = floor(sqrt(2*(n+1)+1/2)-1/2) - floor(sqrt(2*n+1/2)-1/2). - Mikael Aaltonen, Jan 18 2015
a(n) = A003057(n+3) - A003057(n+2). - Robert Israel, Jan 18 2015
a(A000096(n)) = 1; a(A007701(n)) = 0. - Reinhard Zumkeller, Feb 14 2015
Characteristic function of A000096. - M. F. Hasler, Apr 12 2018
Sum_{k=1..n} a(k) ~ sqrt(2*n). - Amiram Eldar, Jan 13 2024