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.

A071797 Restart counting after each new odd integer (a fractal sequence).

Original entry on oeis.org

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

Views

Author

Antonio Esposito, Jun 06 2002

Keywords

Comments

The following sequences all have the same parity: A004737, A006590, A027052, A071028, A071797, A078358, A078446.
This is also a triangle read by rows in which row n lists the first 2*n-1 positive integers, n >= 1 (see example). - Omar E. Pol, May 29 2012
a(n) mod 2 = A071028(n). - Boris Putievskiy, Jul 24 2013
The triangle in the example is the triangle used by Kircheri in 1664. See the link "Mundus Subterraneus". - Charles Kusniec, Sep 11 2022

Examples

			a(1)=1; a(9)=5; a(10)=1;
From _Omar E. Pol_, May 29 2012: (Start)
Written as a triangle the sequence begins:
  1;
  1, 2, 3;
  1, 2, 3, 4, 5;
  1, 2, 3, 4, 5, 6, 7;
  1, 2, 3, 4, 5, 6, 7, 8, 9;
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13;
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15;
Row n has length 2*n - 1 = A005408(n-1). (End)
		

Crossrefs

Cf. A074294.
Row sums give positive terms of A000384.

Programs

  • Haskell
    import Data.List (inits)
    a071797 n = a071797_list !! (n-1)
    a071797_list = f $ tail $ inits [1..] where
       f (xs:_:xss) = xs ++ f xss
    -- Reinhard Zumkeller, Apr 14 2014
  • Maple
    A071797 := proc(n)
        n-A048760(n-1) ;
    end proc: # R. J. Mathar, May 29 2016
  • Mathematica
    Array[Range[2# - 1]&, 10] // Flatten (* Jean-François Alcover, Jan 30 2018 *)
  • PARI
    a(n)=if(n<1,0,n-sqrtint(n-1)^2)
    

Formula

a(n) = 1 + A053186(n-1).
a(n) = n - 1 - ceiling(sqrt(n))*(ceiling(sqrt(n))-2); n > 0.
a(n) = n - floor(sqrt(n-1))^2, distance between n and the next smaller square. - Marc LeBrun, Jan 14 2004