A074294 Integers 1 to 2*k followed by integers 1 to 2*k + 2 and so on.
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
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)
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
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
Comments