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.

A074294 Integers 1 to 2*k followed by integers 1 to 2*k + 2 and so on.

Original entry on oeis.org

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

Views

Author

Michael Somos, Aug 20 2002

Keywords

Comments

From Cino Hilliard, Sep 13 2004: (Start)
Also the numerator of the fraction in the continued fraction expansion of sqrt(n) for nonsquare n = 2,3,5,6,7... . E.g., for n = 7,
sqrt(7).=.2.+.3................
...............4..+.3..........
.....................4..+.3....
...........................4.....
3 is the 5th entry in the table. sqrt(1) and sqrt(4) are not included because 1 and 4 are squares." (End)
A074294 is the natural fractal sequence of A002061; the corresponding natural interspersion is A194011; see A194029 for definitions. - Clark Kimberling, Aug 17 2011
It appears that this is also a triangle read by rows in which row n lists the first 2*n positive integers, n >= 1 (see example). - Omar E. Pol, May 29 2012

Examples

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

Crossrefs

Programs

  • Haskell
    import Data.List (inits)
    a074294 n = a074294_list !! (n-1)
    a074294_list = f $ inits [1..] where
       f (xs:_:xss) = xs ++ f xss
    -- Reinhard Zumkeller, Apr 14 2014
    
  • Maple
    seq(seq((j-n^2-n),j=n^2+n+1..(n+1)^2+n+1),n=0..20); # Robert Israel, Jan 05 2015
  • Mathematica
    A074294[n_] := n - 2*Binomial[Floor[1/2 + Sqrt[n]], 2] (* Enrique Pérez Herrero, Apr 14 2010 *)
    Table[Range[2n],{n,10}]//Flatten (* Harvey P. Dale, Oct 20 2018 *)
  • PARI
    {a(n) = n - 2 * binomial( floor( 1/2 + sqrt(n)), 2)}
    
  • PARI
    c(n) = for(x=2,n,if(issquare(x)==0,a=floor(sqrt(x));print1(x-a^2", "))) /* Cino Hilliard, Sep 13 2004 */
    
  • Python
    from math import isqrt
    def A074294(n): return n+(k:=(m:=isqrt(n))+(n>m*(m+1)))*(1-k) # Chai Wah Wu, Jun 06 2025

Formula

a(n) = n - 2*binomial(floor(1/2 + sqrt(n)), 2).
a(n^2 + n) = 2*n.
a(n) = n - 2 - floor(sqrt(n)+3/2)*floor(sqrt(n)-3/2). - Mikael Aaltonen, Jan 02 2015
G.f.: x/(1-x)^2 - (2*x/(1-x))*Sum_{k>=1} k*x^(k^2+k). That sum is related to Jacobi theta functions. - Robert Israel, Jan 05 2015
a(n) = n + A000194(n) - A053187(n). - Robert Israel, Jan 05 2015