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.

Showing 1-10 of 17 results. Next

A001511 The ruler function: exponent of the highest power of 2 dividing 2n. Equivalently, the 2-adic valuation of 2n.

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 7, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 6, 1, 2, 1, 3, 1, 2, 1, 4, 1
Offset: 1

Views

Author

Keywords

Comments

Number of 2's dividing 2*n.
a(n) is equivalently the exponent of the smallest power of 2 which does not divide n. - David James Sycamore, Oct 02 2023
a(n) - 1 is the number of trailing zeros in the binary expansion of n.
If you are counting in binary and the least significant bit is numbered 1, the next bit is 2, etc., a(n) is the bit that is incremented when increasing from n-1 to n. - Jud McCranie, Apr 26 2004
Number of steps to reach an integer starting with (n+1)/2 and using the map x -> x*ceiling(x) (cf. A073524).
a(n) is the number of the disk to be moved at the n-th step of the optimal solution to Towers of Hanoi problem (comment from Andreas M. Hinz).
Shows which bit to flip when creating the binary reflected Gray code (bits are numbered from the right, offset is 1). This is essentially equivalent to Hinz's comment. - Adam Kertesz, Jul 28 2001
a(n) is the Hamming distance between n and n-1 (in binary). This is equivalent to Kertesz's comments above. - Tak-Shing Chan (chan12(AT)alumni.usc.edu), Feb 25 2003
Let S(0) = {1}, S(n) = {S(n-1), S(n-1)-{x}, x+1} where x = last term of S(n-1); sequence gives S(infinity). - Benoit Cloitre, Jun 14 2003
The sum of all terms up to and including the first occurrence of m is 2^m-1. - Donald Sampson (marsquo(AT)hotmail.com), Dec 01 2003
m appears every 2^m terms starting with the 2^(m-1)th term. - Donald Sampson (marsquo(AT)hotmail.com), Dec 08 2003
Sequence read mod 4 gives A092412. - Philippe Deléham, Mar 28 2004
If q = 2n/2^A001511(n) and if b(m) is defined by b(0)=q-1 and b(m)=2*b(m-1)+1, then 2n = b(A001511(n)) + 1. - Gerald McGarvey, Dec 18 2004
Repeating pattern ABACABADABACABAE ... - Jeremy Gardiner, Jan 16 2005
Relation to C(n) = Collatz function iteration using only odd steps: a(n) is the number of right bits set in binary representation of A004767(n) (numbers of the form 4*m+3). So for m=A004767(n) it follows that there are exactly a(n) recursive steps where m
Between every two instances of any positive integer m there are exactly m distinct values (1 through m-1 and one value greater than m). - Franklin T. Adams-Watters, Sep 18 2006
Number of divisors of n of the form 2^k. - Giovanni Teofilatto, Jul 25 2007
Every prefix up to (but not including) the first occurrence of some k >= 2 is a palindrome. - Gary W. Adamson, Sep 24 2008
1 interleaved with (2 interleaved with (3 interleaved with ( ... ))). - Eric D. Burgess (ericdb(AT)gmail.com), Oct 17 2009
A054525 (Möbius transform) * A001511 = A036987 = A047999^(-1) * A001511. - Gary W. Adamson, Oct 26 2009
Equals A051731 * A036987, (inverse Möbius transform of the Fredholm-Rueppel sequence) = A047999 * A036987. - Gary W. Adamson, Oct 26 2009
Cf. A173238, showing links between generalized ruler functions and A000041. - Gary W. Adamson, Feb 14 2010
Given A000041, P(x) = A(x)/A(x^2) with P(x) = (1 + x + 2x^2 + 3x^3 + 5x^4 + 7x^5 + ...), A(x) = (1 + x + 3x^2 + 4x^3 + 10x^4 + 13x^5 + ...), A(x^2) = (1 + x^2 + 3x^4 + 4x^6 + 10x^8 + ...), where A092119 = (1, 1, 3, 4, 10, ...) = Euler transform of the ruler sequence, A001511. - Gary W. Adamson, Feb 11 2010
Subtracting 1 from every term and deleting any 0's yields the same sequence, A001511. - Ben Branman, Dec 28 2011
In the listing of the compositions of n as lists in lexicographic order, a(k) is the last part of composition(k) for all k <= 2^(n-1) and all n, see example. - Joerg Arndt, Nov 12 2012
According to Hinz, et al. (see links), this sequence was studied by Louis Gros in his 1872 pamphlet "Théorie du Baguenodier" and has therefore been called the Gros sequence.
First n terms comprise least squarefree word of length n using positive integers, where "squarefree" means that the word contains no consecutive identical subwords; e.g., 1 contains no square; 11 contains a square but 12 does not; 121 contains no square; both 1211 and 1212 have squares but 1213 does not; etc. - Clark Kimberling, Sep 05 2013
Length of 0-run starting from 2 (10, 100, 110, 1000, 1010, ...), or length of 1-run starting from 1 (1, 11, 101, 111, 1001, 1011, ...) of every second number, from right to left in binary representation. - Armands Strazds, Apr 13 2017
a(n) is also the frequency of the largest part in the integer partition having viabin number n. The viabin number of an integer partition is defined in the following way. Consider the southeast border of the Ferrers board of the integer partition and consider the binary number obtained by replacing each east step with 1 and each north step, except the last one, with 0. The corresponding decimal form is, by definition, the viabin number of the given integer partition. "Viabin" is coined from "via binary". For example, consider the integer partition [2,2,2,1]. The southeast border of its Ferrers board yields 10100, leading to the viabin number 20. - Emeric Deutsch, Jul 24 2017
As A000005(n) equals the number of even divisors of 2n and A001227(n) = A001227(2n), the formula A001511(n) = A000005(n)/A001227(n) might be read as "The number of even divisors of 2n is always divisible by the number of odd divisors of 2n" (where number of divisors means sum of zeroth powers of divisors). Conjecture: For any nonnegative integer k, the sum of the k-th powers of even divisors of n is always divisible by the sum of the k-th powers of odd divisors of n. - Ivan N. Ianakiev, Jul 06 2019
From Benoit Cloitre, Jul 14 2022: (Start)
To construct the sequence, start from 1's separated by a place 1,,1,,1,,1,,1,,1,,1,,1,,1,,1,,1,,1,,1,,1,...
Then put the 2's in every other remaining place
1,2,1,,1,2,1,,1,2,1,,1,2,1,,1,2,1,,1,2,1,,1,2,1,...
Then the 3's in every other remaining place
1,2,1,3,1,2,1,,1,2,1,3,1,2,1,,1,2,1,3,1,2,1,,1,2,1,...
Then the 4's in every other remaining place
1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,,1,2,1,3,1,2,1,4,1,2,1,...
By iterating this process, we get the ruler function 1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,... (End)
a(n) is the least positive integer k for which there does not exist i+j=n and a(i)=a(j)=k (cf. A322523). - Rémy Sigrist and Jianing Song, Aug 23 2022
a(n) is the smallest positive integer that does not occur in the coincidences of the sequence so far a(1..n-1) and its reverse. - Neal Gersh Tolunsky, Jan 18 2023
The geometric mean of this sequence approaches the Somos constant (A112302). - Jwalin Bhatt, Jan 31 2025

Examples

			For example, 2^1|2, 2^2|4, 2^1|6, 2^3|8, 2^1|10, 2^2|12, ... giving the initial terms 1, 2, 1, 3, 1, 2, ...
From _Omar E. Pol_, Jun 12 2009: (Start)
Triangle begins:
1;
2,1;
3,1,2,1;
4,1,2,1,3,1,2,1;
5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1;
6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1;
7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,6,1,2,1,3,...
(End)
S(0) = {} S(1) = 1 S(2) = 1, 2, 1 S(3) = 1, 2, 1, 3, 1, 2, 1 S(4) = 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1. - Yann David (yann_david(AT)hotmail.com), Mar 21 2010
From _Joerg Arndt_, Nov 12 2012: (Start)
The 16 compositions of 5 as lists in lexicographic order:
[ n]  a(n)  composition
[ 1]  [ 1]  [ 1 1 1 1 1 ]
[ 2]  [ 2]  [ 1 1 1 2 ]
[ 3]  [ 1]  [ 1 1 2 1 ]
[ 4]  [ 3]  [ 1 1 3 ]
[ 5]  [ 1]  [ 1 2 1 1 ]
[ 6]  [ 2]  [ 1 2 2 ]
[ 7]  [ 1]  [ 1 3 1 ]
[ 8]  [ 4]  [ 1 4 ]
[ 9]  [ 1]  [ 2 1 1 1 ]
[10]  [ 2]  [ 2 1 2 ]
[11]  [ 1]  [ 2 2 1 ]
[12]  [ 3]  [ 2 3 ]
[13]  [ 1]  [ 3 1 1 ]
[14]  [ 2]  [ 3 2 ]
[15]  [ 1]  [ 4 1 ]
[16]  [ 5]  [ 5 ]
a(n) is the last part in each list.
(End)
From _Omar E. Pol_, Aug 20 2013: (Start)
Also written as a triangle in which the right border gives A000027 and row lengths give A011782 and row sums give A000079 the sequence begins:
1;
2;
1,3;
1,2,1,4;
1,2,1,3,1,2,1,5;
1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,6;
1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,7;
(End)
G.f. = x + 2*x^2 + x^3 + 3*x^4 + x^5 + 2*x^6 + x^7 + 4*x^8 + x^9 + 2*x^10 + ...
		

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003.
  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 2nd ed., 2001-2003; see Dim- and Dim+ on p. 98; Dividing Rulers, on pp. 436-437; The Ruler Game, pp. 469-470; Ruler Fours, Fives, ... Fifteens on p. 470.
  • L. Gros, Théorie du Baguenodier, Aimé Vingtrinier, Lyon, 1872.
  • R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section E22.
  • A. M. Hinz, The Tower of Hanoi, in Algebras and combinatorics (Hong Kong, 1997), 277-289, Springer, Singapore, 1999.
  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.1.3, Problem 41, p. 589.
  • Andrew Schloss, "Towers of Hanoi" composition, in The Digital Domain. Elektra/Asylum Records 9 60303-2, 1983. Works by Jaffe (Finale to "Silicon Valley Breakdown"), McNabb ("Love in the Asylum"), Schloss ("Towers of Hanoi"), Mattox ("Shaman"), Rush, Moorer ("Lions are Growing") and others.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Column 1 of table A050600.
Sequence read mod 2 gives A035263.
Sequence is bisection of A007814, A050603, A050604, A067029, A089309.
This is Guy Steele's sequence GS(4, 2) (see A135416).
Cf. A005187 (partial sums), A085058 (bisection), A112302 (geometric mean), A171977 (2^a(n)).
Cf. A287896, A002487, A209229 (Mobius trans.), A092673 (Dirichlet inv.).
Cf. generalized ruler functions for k=3,4,5: A051064, A115362, A055457.

Programs

  • Haskell
    a001511 n = length $ takeWhile ((== 0) . (mod n)) a000079_list
    -- Reinhard Zumkeller, Sep 27 2011
    
  • Haskell
    a001511 n | odd n = 1 | otherwise = 1 + a001511 (n `div` 2)
    -- Walt Rorie-Baety, Mar 22 2013
    
  • MATLAB
    nmax=5;r=1;for n=2:nmax;r=[r n r];end % Adriano Caroli, Feb 26 2016
    
  • Magma
    [Valuation(2*n,2): n in [1..105]]; // Bruno Berselli, Nov 23 2015
    
  • Maple
    A001511 := n->2-wt(n)+wt(n-1); # where wt is defined in A000120
    # This is the binary logarithm of the denominator of (256^n-1)B_{8n}/n, in Maple parlance a := n -> log[2](denom((256^n-1)*bernoulli(8*n)/n)). - Peter Luschny, May 31 2009
    A001511 := n -> padic[ordp](2*n,2): seq(A001511(n), n=1..105);  # Peter Luschny, Nov 26 2010
    a:= n-> ilog2((Bits[Xor](2*n, 2*n-1)+1)/2): seq(a(n), n=1..50);  # Gary Detlefs, Dec 13 2018
  • Mathematica
    Array[ If[ Mod[ #, 2] == 0, FactorInteger[ # ][[1, 2]], 0] &, 105] + 1 (* or *)
    Nest[ Flatten[ # /. a_Integer -> {1, a + 1}] &, {1}, 7] (* Robert G. Wilson v, Mar 04 2005 *)
    IntegerExponent[2*n, 2] (* Alexander R. Povolotsky, Aug 19 2011 *)
    myHammingDistance[n_, m_] := Module[{g = Max[m, n], h = Min[m, n]}, b1 = IntegerDigits[g, 2]; b2 = IntegerDigits[h, 2, Length[b1]]; HammingDistance[b1, b2]] (* Vladimir Shevelev A206853 *) Table[ myHammingDistance[n, n - 1], {n, 111}] (* Robert G. Wilson v, Apr 05 2012 *)
    Table[Position[Reverse[IntegerDigits[n,2]],1,1,1],{n,110}]//Flatten (* Harvey P. Dale, Aug 18 2017 *)
  • PARI
    a(n) = sum(k=0,floor(log(n)/log(2)),floor(n/2^k)-floor((n-1)/2^k)) /* Ralf Stephan */
    
  • PARI
    a(n)=if(n%2,1,factor(n)[1,2]+1) /* Jon Perry, Jun 06 2004 */
    
  • PARI
    {a(n) = if( n, valuation(n, 2) + 1, 0)}; /* Michael Somos, Sep 30 2006 */
    
  • PARI
    {a(n)=if(n==1,1,polcoeff(x-sum(k=1, n-1, a(k)*x^k*(1-x^k)*(1-x+x*O(x^n))), n))} /* Paul D. Hanna, Jun 22 2007 */
    
  • Python
    def a(n): return bin(n)[2:][::-1].index("1") + 1 # Indranil Ghosh, May 11 2017
    
  • Python
    A001511 = lambda n: (n&-n).bit_length() # M. F. Hasler, Apr 09 2020
    
  • Python
    def A001511(n): return (~n & n-1).bit_length()+1 # Chai Wah Wu, Jul 01 2022
    
  • Sage
    [valuation(2*n,2) for n in (1..105)]  # Bruno Berselli, Nov 23 2015
    
  • Scheme
    (define (A001511 n) (let loop ((n n) (e 1)) (if (odd? n) e (loop (/ n 2) (+ 1 e))))) ;; Antti Karttunen, Oct 06 2017

Formula

a(n) = A007814(n) + 1 = A007814(2*n).
a(2*n+1) = 1; a(2*n) = 1 + a(n). - Philippe Deléham, Dec 08 2003
a(n) = 2 - A000120(n) + A000120(n-1), n >= 1. - Daniele Parisse
a(n) = 1 + log_2(abs(A003188(n) - A003188(n-1))).
Multiplicative with a(p^e) = e+1 if p = 2; 1 if p > 2. - David W. Wilson, Aug 01 2001
For any real x > 1/2: lim_{N->infinity} (1/N)*Sum_{n=1..N} x^(-a(n)) = 1/(2*x-1); also lim_{N->infinity} (1/N)*Sum_{n=1..N} 1/a(n) = log(2). - Benoit Cloitre, Nov 16 2001
s(n) = Sum_{k=1..n} a(k) is asymptotic to 2*n since s(n) = 2*n - A000120(n). - Benoit Cloitre, Aug 31 2002
For any n >= 0, for any m >= 1, a(2^m*n + 2^(m-1)) = m. - Benoit Cloitre, Nov 24 2002
a(n) = Sum_{d divides n and d is odd} mu(d)*tau(n/d). - Vladeta Jovovic, Dec 04 2002
G.f.: A(x) = Sum_{k>=0} x^(2^k)/(1-x^(2^k)). - Ralf Stephan, Dec 24 2002
a(1) = 1; for n > 1, a(n) = a(n-1) + (-1)^n*a(floor(n/2)). - Vladeta Jovovic, Apr 25 2003
A fixed point of the mapping 1->12; 2->13; 3->14; 4->15; 5->16; ... . - Philippe Deléham, Dec 13 2003
Product_{k>0} (1+x^k)^a(k) is g.f. for A000041(). - Vladeta Jovovic, Mar 26 2004
G.f. A(x) satisfies A(x) = A(x^2) + x/(1-x). - Franklin T. Adams-Watters, Feb 09 2006
a(A118413(n,k)) = A002260(n,k); = a(A118416(n,k)) = A002024(n,k); a(A014480(n)) = A003602(A014480(n)). - Reinhard Zumkeller, Apr 27 2006
Ordinal transform of A003602. - Franklin T. Adams-Watters, Aug 28 2006 (The ordinal transform of a sequence b_0, b_1, b_2, ... is the sequence a_0, a_1, a_2, ... where a_n is the number of times b_n has occurred in {b_0 ... b_n}.)
Could be extended to n <= 0 using a(-n) = a(n), a(0) = 0, a(2*n) = a(n)+1 unless n=0. - Michael Somos, Sep 30 2006
A094267(2*n) = A050603(2*n) = A050603(2*n + 1) = a(n). - Michael Somos, Sep 30 2006
Sequence = A129360 * A000005 = M*V, where M = an infinite lower triangular matrix and V = d(n) as a vector: [1, 2, 2, 3, 2, 4, ...]. - Gary W. Adamson, Apr 15 2007
Row sums of triangle A130093. - Gary W. Adamson, May 13 2007
Dirichlet g.f.: zeta(s)*2^s/(2^s-1). - Ralf Stephan, Jun 17 2007
a(n) = -Sum_{d divides n} mu(2*d)*tau(n/d). - Benoit Cloitre, Jun 21 2007
G.f.: x/(1-x) = Sum_{n>=1} a(n)*x^n*( 1 - x^n ). - Paul D. Hanna, Jun 22 2007
2*n = 2^a(n)* A000265(n). - Eric Desbiaux, May 14 2009 [corrected by Alejandro Erickson, Apr 17 2012]
Multiplicative with a(2^k) = k + 1, a(p^k) = 1 for any odd prime p. - Franklin T. Adams-Watters, Jun 09 2009
With S(n): 2^n - 1 first elements of the sequence then S(0) = {} (empty list) and if n > 0, S(n) = S(n-1), n, S(n-1). - Yann David (yann_david(AT)hotmail.com), Mar 21 2010
a(n) = log_2(A046161(n)/A046161(n-1)). - Johannes W. Meijer, Nov 04 2012
a((2*n-1)*2^p) = p+1, p >= 0 and n >= 1. - Johannes W. Meijer, Feb 05 2013
a(n+1) = 1 + Sum_{j=0..ceiling(log_2(n+1))} (j * (1 - abs(sign((n mod 2^(j + 1)) - 2^j + 1)))). - Enrico Borba, Oct 01 2015
Conjecture: a(n) = A181988(n)/A003602(n). - L. Edson Jeffery, Nov 21 2015
a(n) = log_2(A006519(n)) + 1. - Doug Bell, Jun 02 2017
Inverse Moebius transform of A209229. - Andrew Howroyd, Aug 04 2018
a(n) = 1 + (A183063(n)/A001227(n)). - Omar E. Pol, Nov 06 2018 (after Franklin T. Adams-Watters)
a(n) = log_2((Xor(2*n,2*n-1)+1)/2). - Gary Detlefs, Dec 13 2018
(2^(a(n)-1)-1)*(n mod 4) = 2*floor(((n+1) mod 4)/3). - Gary Detlefs, Dec 14 2018
a(n) = A000005(n)/A001227(n). - Ivan N. Ianakiev, Jul 05 2019
a(n) = Sum_{j=1..r} (j/2^j)*(Product_{k=1..j} (1 - (-1)^floor( (n+2^(j-1))/2^(k-1) ))), for n < a predefined 2^r. - Adriano Caroli, Sep 30 2019

Extensions

Name edited following suggestion by David James Sycamore, Oct 05 2023

A002260 Triangle read by rows: T(n,k) = k for n >= 1, k = 1..n.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 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, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
Offset: 1

Author

Angele Hamel (amh(AT)maths.soton.ac.uk)

Comments

Old name: integers 1 to k followed by integers 1 to k+1 etc. (a fractal sequence).
Start counting again and again.
This is a "doubly fractal sequence" - see the Franklin T. Adams-Watters link.
The PARI functions t1, t2 can be used to read a square array T(n,k) (n >= 1, k >= 1) by antidiagonals downwards: n -> T(t1(n), t2(n)). - Michael Somos, Aug 23 2002
Reading this sequence as the antidiagonals of a rectangular array, row n is (n,n,n,...); this is the weight array (Cf. A144112) of the array A127779 (rectangular). - Clark Kimberling, Sep 16 2008
The upper trim of an arbitrary fractal sequence s is s, but the lower trim of s, although a fractal sequence, need not be s itself. However, the lower trim of A002260 is A002260. (The upper trim of s is what remains after the first occurrence of each term is deleted; the lower trim of s is what remains after all 0's are deleted from the sequence s-1.) - Clark Kimberling, Nov 02 2009
Eigensequence of the triangle = A001710 starting (1, 3, 12, 60, 360, ...). - Gary W. Adamson, Aug 02 2010
The triangle sums, see A180662 for their definitions, link this triangle of natural numbers with twenty-three different sequences, see the crossrefs. The mirror image of this triangle is A004736. - Johannes W. Meijer, Sep 22 2010
A002260 is the self-fission of the polynomial sequence (q(n,x)), where q(n,x) = x^n + x^(n-1) + ... + x + 1. See A193842 for the definition of fission. - Clark Kimberling, Aug 07 2011
Sequence B is called a reluctant sequence of sequence A, if B is triangle array read by rows: row number k coincides with first k elements of the sequence A. Sequence A002260 is reluctant sequence of sequence 1,2,3,... (A000027). - Boris Putievskiy, Dec 12 2012
This is the maximal sequence of positive integers, such that once an integer k has occurred, the number of k's always exceeds the number of (k+1)'s for the remainder of the sequence, with the first occurrence of the integers being in order. - Franklin T. Adams-Watters, Oct 23 2013
A002260 are the k antidiagonal numerators of rationals in Cantor's proof of 1-to-1 correspondence between rationals and naturals; the denominators are k-numerator+1. - Adriano Caroli, Mar 24 2015
T(n,k) gives the distance to the largest triangular number < n. - Ctibor O. Zizka, Apr 09 2020

Examples

			First six rows:
  1
  1   2
  1   2   3
  1   2   3   4
  1   2   3   4   5
  1   2   3   4   5   6
		

References

  • Clark Kimberling, "Fractal sequences and interspersions," Ars Combinatoria 45 (1997) 157-168. (Introduces upper trimming, lower trimming, and signature sequences.)
  • M. Myers, Smarandache Crescendo Subsequences, R. H. Wilde, An Anthology in Memoriam, Bristol Banner Books, Bristol, 1998, p. 19.
  • F. Smarandache, Sequences of Numbers Involved in Unsolved Problems, Hexis, Phoenix, 2006.

Crossrefs

Cf. A140756 (alternating signs).
Triangle sums (see the comments): A000217 (Row1, Kn11); A004526 (Row2); A000096 (Kn12); A055998 (Kn13); A055999 (Kn14); A056000 (Kn15); A056115 (Kn16); A056119 (Kn17); A056121 (Kn18); A056126 (Kn19); A051942 (Kn110); A101859 (Kn111); A132754 (Kn112); A132755 (Kn113); A132756 (Kn114); A132757 (Kn115); A132758 (Kn116); A002620 (Kn21); A000290 (Kn3); A001840 (Ca2); A000326 (Ca3); A001972 (Gi2); A000384 (Gi3).
Cf. A108872.

Programs

  • Haskell
    a002260 n k = k
    a002260_row n = [1..n]
    a002260_tabl = iterate (\row -> map (+ 1) (0 : row)) [1]
    -- Reinhard Zumkeller, Aug 04 2014, Jul 03 2012
    
  • Maple
    at:=0; for n from 1 to 150 do for i from 1 to n do at:=at+1; lprint(at,i); od: od: # N. J. A. Sloane, Nov 01 2006
    seq(seq(i,i=1..k),k=1..13); # Peter Luschny, Jul 06 2009
  • Mathematica
    FoldList[{#1, #2} &, 1, Range[2, 13]] // Flatten (* Robert G. Wilson v, May 10 2011 *)
    Flatten[Table[Range[n],{n,20}]] (* Harvey P. Dale, Jun 20 2013 *)
  • Maxima
    T(n,k):=sum((i+k)*binomial(i+k-1,i)*binomial(k,n-i-k+1)*(-1)^(n-i-k+1),i,max(0,n+1-2*k),n-k+1); /* Vladimir Kruchinin, Oct 18 2013 */
    
  • PARI
    t1(n)=n-binomial(floor(1/2+sqrt(2*n)),2) /* this sequence */
    
  • PARI
    A002260(n)=n-binomial((sqrtint(8*n)+1)\2,2) \\ M. F. Hasler, Mar 10 2014
    
  • Python
    from math import isqrt, comb
    def A002260(n): return n-comb((m:=isqrt(k:=n<<1))+(k>m*(m+1)),2) # Chai Wah Wu, Nov 08 2024

Formula

a(n) = 1 + A002262(n).
n-th term is n - m*(m+1)/2 + 1, where m = floor((sqrt(8*n+1) - 1) / 2).
The above formula is for offset 0; for offset 1, use a(n) = n-m*(m+1)/2 where m = floor((-1+sqrt(8*n-7))/2). - Clark Kimberling, Jun 14 2011
a(k * (k + 1) / 2 + i) = i for k >= 0 and 0 < i <= k + 1. - Reinhard Zumkeller, Aug 14 2001
a(n) = (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2. - Brian Tenneson, Oct 11 2003
a(n) = n - binomial(floor((1+sqrt(8*n))/2), 2). - Paul Barry, May 25 2004
T(n,k) = A001511(A118413(n,k)); T(n,k) = A003602(A118416(n,k)). - Reinhard Zumkeller, Apr 27 2006
a(A000217(n)) = A000217(n) - A000217(n-1), a(A000217(n-1) + 1) = 1, a(A000217(n) - 1) = A000217(n) - A000217(n-1) - 1. - Alexander R. Povolotsky, May 28 2008
a(A169581(n)) = A038566(n). - Reinhard Zumkeller, Dec 02 2009
T(n,k) = Sum_{i=1..k} i*binomial(k,i)*binomial(n-k,n-i) (regarded as triangle, see the example). - Mircea Merca, Apr 11 2012
T(n,k) = Sum_{i=max(0,n+1-2*k)..n-k+1} (i+k)*binomial(i+k-1,i)*binomial(k,n-i-k+1)*(-1)^(n-i-k+1). - Vladimir Kruchinin, Oct 18 2013
G.f.: x*y / ((1 - x) * (1 - x*y)^2) = Sum_{n,k>0} T(n,k) * x^n * y^k. - Michael Somos, Sep 17 2014
a(n) = n - S(n) where S(n) = sum of distinct terms in {a(1), a(2), ..., a(n-1)}. - David James Sycamore, Mar 10 2025

Extensions

More terms from Reinhard Zumkeller, Apr 27 2006
Incorrect program removed by Franklin T. Adams-Watters, Mar 19 2010
New name from Omar E. Pol, Jul 15 2012

A002024 k appears k times; a(n) = floor(sqrt(2n) + 1/2).

Original entry on oeis.org

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

Keywords

Comments

Integer inverse function of the triangular numbers A000217. The function trinv(n) = floor((1+sqrt(1+8n))/2), n >= 0, gives the values 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, ..., that is, the same sequence with offset 0. - N. J. A. Sloane, Jun 21 2009
Array T(k,n) = n+k-1 read by antidiagonals.
Eigensequence of the triangle = A001563. - Gary W. Adamson, Dec 29 2008
Can apparently also be defined via a(n+1)=b(n) for n >= 2 where b(0)=b(1)=1 and b(n) = b(n-b(n-2))+1. Tested to be correct for all n <= 150000. - José María Grau Ribas, Jun 10 2011
For any n >= 0, a(n+1) is the least integer m such that A000217(m)=m(m+1)/2 is larger than n. This is useful when enumerating representations of n as difference of triangular numbers; see also A234813. - M. F. Hasler, Apr 19 2014
Number of binary digits of A023758, i.e., a(n) = ceiling(log_2(A023758(n+2))). - Andres Cicuttin, Apr 29 2016
a(n) and A002260(n) give respectively the x(n) and y(n) coordinates of the sorted sequence of points in the integer lattice such that x(n) > 0, 0 < y(n) <= x(n), and min(x(n), y(n)) < max(x(n+1), y(n+1)) for n > 0. - Andres Cicuttin, Dec 25 2016
Partial sums (A060432) are given by S(n) = (-a(n)^3 + a(n)*(1+6n))/6. - Daniel Cieslinski, Oct 23 2017
As an array, T(k,n) is the number of digits columns used in carryless multiplication between a k-digit number and an n-digit number. - Stefano Spezia, Sep 24 2022
a(n) is the maximum number of possible solutions to an n-statement Knights and Knaves Puzzle, where each statement is of the form "x of us are knights" for some 1 <= x <= n, knights can only tell the truth and knaves can only lie. - Taisha Charles and Brittany Ohlinger, Jul 29 2023

Examples

			From _Clark Kimberling_, Sep 16 2008: (Start)
As a rectangular array, a northwest corner:
  1 2 3 4 5 6
  2 3 4 5 6 7
  3 4 5 6 7 8
  4 5 6 7 8 9
This is the weight array (cf. A144112) of A107985 (formatted as a rectangular array). (End)
G.f. = x + 2*x^2 + 2*x^3 + 3*x^4 + 3*x^5 + 3*x^6 + 4*x^7 + 4*x^9 + 4*x^9 + 4*x^10 + ...
		

References

  • Edward S. Barbeau, Murray S. Klamkin, and William O. J. Moser, Five Hundred Mathematical Challenges, Prob. 441, pp. 41, 194. MAA 1995.
  • R. L. Graham, D. E. Knuth, and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 97.
  • K. Hardy and K. S. Williams, The Green Book of Mathematical Problems, p. 59, Solution to Prob. 14, Dover NY, 1985
  • R. Honsberger, Mathematical Morsels, pp. 133-134, MAA 1978.
  • J. F. Hurley, Litton's Problematical Recreations, pp. 152; 313-4 Prob. 22, VNR Co., NY, 1971.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 1, p. 43.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.

Crossrefs

a(n+1) = 1+A003056(n), A022846(n)=a(n^2), a(n+1)=A002260(n)+A025581(n).
A123578 is an essentially identical sequence.

Programs

  • Haskell
    a002024 n k = a002024_tabl !! (n-1) !! (k-1)
    a002024_row n = a002024_tabl !! (n-1)
    a002024_tabl = iterate (\xs@(x:_) -> map (+ 1) (x : xs)) [1]
    a002024_list = concat a002024_tabl
    a002024' = round . sqrt . (* 2) . fromIntegral
    -- Reinhard Zumkeller, Jul 05 2015, Feb 12 2012, Mar 18 2011
    
  • Haskell
    a002024_list = [1..] >>= \n -> replicate n n
    
  • Haskell
    a002024 = (!!) $ [1..] >>= \n -> replicate n n
    -- Sascha Mücke, May 10 2016
    
  • Magma
    [Floor(Sqrt(2*n) + 1/2): n in [1..80]]; // Vincenzo Librandi, Nov 19 2014
    
  • Maple
    A002024 := n-> ceil((sqrt(1+8*n)-1)/2); seq(A002024(n), n=1..100);
  • Mathematica
    a[1] = 1; a[n_] := a[n] = a[n - a[n - 1]] + 1 (* Branko Curgus, May 12 2009 *)
    Table[n, {n, 13}, {n}] // Flatten (* Robert G. Wilson v, May 11 2010 *)
    Table[PadRight[{},n,n],{n,15}]//Flatten (* Harvey P. Dale, Jan 13 2019 *)
  • PARI
    t1(n)=floor(1/2+sqrt(2*n)) /* A002024 = this sequence */
    
  • PARI
    t2(n)=n-binomial(floor(1/2+sqrt(2*n)),2) /* A002260(n-1) */
    
  • PARI
    t3(n)=binomial(floor(3/2+sqrt(2*n)),2)-n+1 /* A004736 */
    
  • PARI
    t4(n)=n-1-binomial(floor(1/2+sqrt(2*n)),2) /* A002260(n-1)-1 */
    
  • PARI
    A002024(n)=(sqrtint(n*8)+1)\2 \\ M. F. Hasler, Apr 19 2014
    
  • PARI
    a(n)=(sqrtint(8*n-7)+1)\2
    
  • PARI
    a(n)=my(k=1);while(binomial(k+1,2)+1<=n,k++);k \\ R. J. Cano, Mar 17 2014
    
  • Python
    from math import isqrt
    def A002024(n): return (isqrt(8*n)+1)//2 # Chai Wah Wu, Feb 02 2022
  • Sage
    [floor(sqrt(2*n) +1/2) for n in (1..80)] # G. C. Greubel, Dec 10 2018
    

Formula

a(n) = floor(1/2 + sqrt(2n)). Also a(n) = ceiling((sqrt(1+8n)-1)/2). [See the Liu link for a large collection of explicit formulas. - N. J. A. Sloane, Oct 30 2019]
a((k-1)*k/2 + i) = k for k > 0 and 0 < i <= k. - Reinhard Zumkeller, Aug 30 2001
a(n) = a(n - a(n-1)) + 1, with a(1)=1. - Ian M. Levitt (ilevitt(AT)duke.poly.edu), Aug 18 2002
a(n) = round(sqrt(2n)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Nov 01 2002
T(n,k) = A003602(A118413(n,k)); = T(n,k) = A001511(A118416(n,k)). - Reinhard Zumkeller, Apr 27 2006
G.f.: (x/(1-x))*Product_{k>0} (1-x^(2*k))/(1-x^(2*k-1)). - Vladeta Jovovic, Oct 06 2003
Equals A127899 * A004736. - Gary W. Adamson, Feb 09 2007
Sum_{i=1..n} Sum_{j=i..n+i-1} T(j,i) = A000578(n); Sum_{i=1..n} T(n,i) = A000290(n). - Reinhard Zumkeller, Jun 24 2007
a(n) + n = A014132(n). - Vincenzo Librandi, Jul 08 2010
a(n) = ceiling(-1/2 + sqrt(2n)). - Branko Curgus, May 12 2009
a(A169581(n)) = A038567(n). - Reinhard Zumkeller, Dec 02 2009
a(n) = round(sqrt(2*n)) = round(sqrt(2*n-1)); there exist a and b greater than zero such that 2*n = 2+(a+b)^2 -(a+3*b) and a(n)=(a+b-1). - Fabio Civolani (civox(AT)tiscali.it), Feb 23 2010
A005318(n+1) = 2*A005318(n) - A205744(n), A205744(n) = A005318(A083920(n)), A083920(n) = n - a(n). - N. J. A. Sloane, Feb 11 2012
Expansion of psi(x) * x / (1 - x) in powers of x where psi() is a Ramanujan theta function. - Michael Somos, Mar 19 2014
G.f.: (x/(1-x)) * Product_{n>=1} (1 + x^n) * (1 - x^(2*n)). - Paul D. Hanna, Feb 27 2016
a(n) = 1 + Sum_{i=1..n/2} ceiling(floor(2(n-1)/(i^2+i))/(2n)). - José de Jesús Camacho Medina, Jan 07 2017
a(n) = floor((sqrt(8*n-7)+1)/2). - Néstor Jofré, Apr 24 2017
a(n) = floor((A000196(8*n)+1)/2). - Pontus von Brömssen, Dec 10 2018
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 (A003881). - Amiram Eldar, Oct 01 2022
G.f. as array: (x^2*(1 - y)^2 + y^2 + x*y*(1 - 2*y))/((1 - x)^2*(1 - y)^2). - Stefano Spezia, Apr 22 2024

A016825 Positive integers congruent to 2 (mod 4): a(n) = 4*n+2, for n >= 0.

Original entry on oeis.org

2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98, 102, 106, 110, 114, 118, 122, 126, 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, 218, 222, 226, 230, 234
Offset: 0

Keywords

Comments

Twice the odd numbers, also called singly even numbers.
Numbers having equal numbers of odd and even divisors: A001227(a(n)) = A000005(2*a(n)). - Reinhard Zumkeller, Dec 28 2003
Continued fraction for coth(1/2) = (e+1)/(e-1). The continued fraction for tanh(1/2) = (e-1)/(e+1) would be a(0) = 0, a(n) = A016825(n-1), n >= 1.
No solutions to a(n) = b^2 - c^2. - Henry Bottomley, Jan 13 2001
Sequence gives m such that 8 is the largest power of 2 dividing A003629(k)^m-1 for any k. - Benoit Cloitre, Apr 05 2002
k such that Sum_{d|k} (-1)^d = A048272(k) = 0. - Benoit Cloitre, Apr 15 2002
Also k such that Sum_{d|k} phi(d)*mu(k/d) = A007431(k) = 0. - Benoit Cloitre, Apr 15 2002
Also k such that Sum_{d|k} (d/A000005(d))*mu(k/d) = 0, k such that Sum_{d|k}(A000005(d)/d)*mu(k/d) = 0. - Benoit Cloitre, Apr 19 2002
Solutions to phi(x) = phi(x/2); primorial numbers are here. - Labos Elemer, Dec 16 2002
Together with 1, numbers that are not the leg of a primitive Pythagorean triangle. - Lekraj Beedassy, Nov 25 2003
For n > 0: complement of A107750 and A023416(a(n)-1) = A023416(a(n)) <> A023416(a(n)+1). - Reinhard Zumkeller, May 23 2005
Also the minimal value of Sum_{i=1..n+2} (p(i) - p(i+1))^2, where p(n+3) = p(1), as p ranges over all permutations of {1,2,...,n+2} (see the Mihai reference). Example: a(2)=10 because the values of the sum for the permutations of {1,2,3,4} are 10 (8 times), 12 (8 times) and 18 (8 times). - Emeric Deutsch, Jul 30 2005
Except for a(n)=2, numbers having 4 as an anti-divisor. - Alexandre Wajnberg, Oct 02 2005
A139391(a(n)) = A006370(a(n)) = A005408(n). - Reinhard Zumkeller, Apr 17 2008
Also a(n) = (n-1) + n + (n+1) + (n+2), so a(n) and -a(n) are all the integers that are sums of four consecutive integers. - Rick L. Shepherd, Mar 21 2009
The denominator in Pi/8 = 1/2 - 1/6 + 1/10 - 1/14 + 1/18 - 1/22 + .... - Mohammad K. Azarian, Oct 13 2011
This sequence gives the positive zeros of i^x + 1 = 0, x real, where i^x = exp(i*x*Pi/2). - Ilya Gutkovskiy, Aug 08 2015
Numbers k such that Sum_{j=1..k} j^3 is not a multiple of k. - Chai Wah Wu, Aug 23 2017
Numbers k such that Lucas(k) is a multiple of 3. - Bruno Berselli, Oct 17 2017
Also numbers k such that t^k == -1 (mod 5), where t is a term of A047221. - Bruno Berselli, Dec 28 2017
The even numbers form a ring, and these are the primes in that ring. Note that unique factorization into primes does not hold, since 60 = 2*30 = 6*10. - N. J. A. Sloane, Nov 11 2019
Also numbers ending with 10 in base 2. - John Keith, May 09 2022

Examples

			0.4621171572600097585023184... = 0 + 1/(2 + 1/(6 + 1/(10 + 1/(14 + ...)))), i.e., c.f. for tanh(1/2).
2.1639534137386528487700040... = 2 + 1/(6 + 1/(10 + 1/(14 + 1/(18 + ...)))), i.e., c.f. for coth(1/2).
		

References

  • H. Bass, Mathematics, Mathematicians and Mathematics Education, Bull. Amer. Math. Soc. (N.S.) 42 (2004), no. 4, 417-430.
  • Arthur Beiser, Concepts of Modern Physics, 2nd Ed., McGraw-Hill, 1973.
  • J. R. Goldman, The Queen of Mathematics, 1998, p. 70.
  • Granino A. Korn and Theresa M. Korn, Mathematical Handbook for Scientists and Engineers, McGraw-Hill Book Company, New York (1968).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 262, 278.

Crossrefs

First differences of A001105.
Cf. A160327 (decimal expansion).
Subsequence of A042963.
Essentially the complement of A042965.

Programs

Formula

a(n) = 4*n + 2, for n >= 0.
a(n) = 2*A005408(n). - Lekraj Beedassy, Nov 28 2003
a(n) = A118413(n+1,2) for n>1. - Reinhard Zumkeller, Apr 27 2006
From Michael Somos, Apr 11 2007: (Start)
G.f.: 2*(1+x)/(1-x)^2.
E.g.f.: 2*(1+2*x)*exp(x).
a(n) = a(n-1) + 4.
a(-1-n) = -a(n). (End)
a(n) = 8*n - a(n-1) for n > 0, a(0)=2. - Vincenzo Librandi, Nov 20 2010
From Reinhard Zumkeller, Jun 11 2012, Jun 30 2012 and Jul 20 2012: (Start)
A080736(a(n)) = 0.
A007814(a(n)) = 1;
A037227(a(n)) = 3.
A214546(a(n)) = 0. (End)
a(n) = T(n+2) - T(n-2) where T(n) = n*(n+1)/2 = A000217(n). In general, if M(k,n) = 2*k*n + k, then M(k,n) = T(n+k) - T(n-k). - Charlie Marion, Feb 24 2020
From Amiram Eldar, Nov 22 2024: (Start)
Product_{n>=1} (1 - (-1)^n/a(n)) = 1/sqrt(2-sqrt(2)) (A285871).
Product_{n>=1} (1 + (-1)^n/a(n)) = sqrt(1-1/sqrt(2)) (A154739). (End)

A003602 Kimberling's paraphrases: if n = (2k-1)*2^m then a(n) = k.

Original entry on oeis.org

1, 1, 2, 1, 3, 2, 4, 1, 5, 3, 6, 2, 7, 4, 8, 1, 9, 5, 10, 3, 11, 6, 12, 2, 13, 7, 14, 4, 15, 8, 16, 1, 17, 9, 18, 5, 19, 10, 20, 3, 21, 11, 22, 6, 23, 12, 24, 2, 25, 13, 26, 7, 27, 14, 28, 4, 29, 15, 30, 8, 31, 16, 32, 1, 33, 17, 34, 9, 35, 18, 36, 5, 37, 19, 38, 10, 39, 20, 40, 3, 41, 21, 42
Offset: 1

Keywords

Comments

Fractal sequence obtained from powers of 2.
k occurs at (2*k-1)*A000079(m), m >= 0. - Robert G. Wilson v, May 23 2006
Sequence is T^(oo)(1) where T is acting on a word w = w(1)w(2)..w(m) as follows: T(w) = "1"w(1)"2"w(2)"3"(...)"m"w(m)"m+1". For instance T(ab) = 1a2b3. Thus T(1) = 112, T(T(1)) = 1121324, T(T(T(1))) = 112132415362748. - Benoit Cloitre, Mar 02 2009
Note that iterating the post-numbering operator U(w) = w(1) 1 w(2) 2 w(3) 3... produces the same limit sequence except with an additional "1" prepended, i.e., 1,1,1,2,1,3,2,4,... - Glen Whitney, Aug 30 2023
In the binary expansion of n, first swallow all zeros from the right, then add 1, and swallow the now-appearing 0 bit as well. - Ralf Stephan, Aug 22 2013
Although A264646 and this sequence initially agree in their digit-streams, they differ after 48 digits. - N. J. A. Sloane, Nov 20 2015
"[This is a] fractal because we get the same sequence after we delete from it the first appearance of all positive integers" - see Cobeli and Zaharescu link. - Robert G. Wilson v, Jun 03 2018
From Peter Munn, Jun 16 2022: (Start)
The sequence is the list of positive integers interleaved with the sequence itself. Provided the offset is suitable (which is the case here) a term of such a self-interleaved sequence is determined by the odd part of its index. Putting some of the formulas given here into words, a(n) is the position of the odd part of n in the list of odd numbers.
Applying the interleaving transform again, we get A110963.
(End)
Omitting all 1's leaves A131987 + 1. - David James Sycamore, Jul 26 2022
a(n) is also the smallest positive number not among the terms between a(a(n-1)) and a(n-1) inclusive (with a(0)=1 prepended). - Neal Gersh Tolunsky, Mar 07 2023

Examples

			From _Peter Munn_, Jun 14 2022: (Start)
Start of table showing the interleaving with the positive integers:
   n  a(n)  (n+1)/2  a(n/2)
   1    1      1
   2    1               1
   3    2      2
   4    1               1
   5    3      3
   6    2               2
   7    4      4
   8    1               1
   9    5      5
  10    3               3
  11    6      6
  12    2               2
(End)
		

References

  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

a(n) is the index of the column in A135764 where n appears (see also A054582).
Cf. A000079, A000265, A001511, A003603, A003961, A014577 (with offset 1, reduction mod 2), A025480, A035528, A048673, A101279, A110963, A117303, A126760, A181988, A220466, A249745, A253887, A337821 (2-adic valuation).
Cf. also A349134 (Dirichlet inverse), A349135 (sum with it), A349136 (Möbius transform), A349431, A349371 (inverse Möbius transform).
Cf. A264646.

Programs

  • Haskell
    a003602 = (`div` 2) . (+ 1) . a000265
    -- Reinhard Zumkeller, Feb 16 2012, Oct 14 2010
    
  • Haskell
    import Data.List (transpose)
    a003602 = flip div 2 . (+ 1) . a000265
    a003602_list = concat $ transpose [[1..], a003602_list]
    -- Reinhard Zumkeller, Aug 09 2013, May 23 2013
    
  • Maple
    A003602:=proc(n) options remember: if n mod 2 = 1 then RETURN((n+1)/2) else RETURN(procname(n/2)) fi: end proc:
    seq(A003602(n), n=1..83); # Pab Ter
    nmax := 83: for m from 0 to ceil(simplify(log[2](nmax))) do for k from 1 to ceil(nmax/(m+2)) do a((2*k-1)*2^m) := k od: od: seq(a(k), k=1..nmax); # Johannes W. Meijer, Feb 04 2013
    A003602 := proc(n)
        a := 1;
        for p in ifactors(n)[2] do
            if op(1,p) > 2 then
                a := a*op(1,p)^op(2,p) ;
            end if;
        end do  :
        (a+1)/2 ;
    end proc: # R. J. Mathar, May 19 2016
  • Mathematica
    a[n_] := Block[{m = n}, While[ EvenQ@m, m /= 2]; (m + 1)/2]; Array[a, 84] (* or *)
    a[1] = 1; a[n_] := a[n] = If[OddQ@n, (n + 1)/2, a[n/2]]; Array[a, 84] (* Robert G. Wilson v, May 23 2006 *)
    a[n_] := Ceiling[NestWhile[Floor[#/2] &, n, EvenQ]/2]; Array[a, 84] (* Birkas Gyorgy, Apr 05 2011 *)
    a003602 = {1}; max = 7; Do[b = {}; Do[AppendTo[b, {k, a003602[[k]]}], {k, Length[a003602]}]; a003602 = Flatten[b], {n, 2, max}]; a003602 (* L. Edson Jeffery, Nov 21 2015 *)
  • PARI
    A003602(n)=(n/2^valuation(n,2)+1)/2; /* Joerg Arndt, Apr 06 2011 */
    
  • Python
    import math
    def a(n): return (n/2**int(math.log(n - (n & n - 1), 2)) + 1)/2 # Indranil Ghosh, Apr 24 2017
    
  • Python
    def A003602(n): return (n>>(n&-n).bit_length())+1 # Chai Wah Wu, Jul 08 2022
  • Scheme
    (define (A003602 n) (let loop ((n n)) (if (even? n) (loop (/ n 2)) (/ (+ 1 n) 2)))) ;; Antti Karttunen, Feb 04 2015
    

Formula

a(n) = (A000265(n) + 1)/2.
a((2*k-1)*2^m) = k, for m >= 0 and k >= 1. - Robert G. Wilson v, May 23 2006
Inverse Weigh transform of A035528. - Christian G. Bower
G.f.: 1/x * Sum_{k>=0} x^2^k/(1-2*x^2^(k+1) + x^2^(k+2)). - Ralf Stephan, Jul 24 2003
a(2*n-1) = n and a(2*n) = a(n). - Pab Ter (pabrlos2(AT)yahoo.com), Oct 25 2005
a(A118413(n,k)) = A002024(n,k); = a(A118416(n,k)) = A002260(n,k); a(A014480(n)) = A001511(A014480(n)). - Reinhard Zumkeller, Apr 27 2006
Ordinal transform of A001511. - Franklin T. Adams-Watters, Aug 28 2006
a(n) = A249745(A126760(A003961(n))) = A249745(A253887(A048673(n))). That is, this sequence plays the same role for the numbers in array A135764 as A126760 does for the odd numbers in array A135765. - Antti Karttunen, Feb 04 2015 & Jan 19 2016
G.f. satisfies g(x) = g(x^2) + x/(1-x^2)^2. - Robert Israel, Apr 24 2015
a(n) = A181988(n)/A001511(n). - L. Edson Jeffery, Nov 21 2015
a(n) = A025480(n-1) + 1. - R. J. Mathar, May 19 2016
a(n) = A110963(2n-1) = A349135(4*n). - Antti Karttunen, Apr 18 2022
a(n) = (1 + n)/2, for n odd; a(n) = a(n/2), for n even. - David James Sycamore, Jul 28 2022
a(n) = n/2^A001511(n) + 1/2. - Alan Michael Gómez Calderón, Oct 06 2023
a(n) = A123390(A118319(n)). - Flávio V. Fernandes, Mar 02 2025

Extensions

More terms from Pab Ter (pabrlos2(AT)yahoo.com), Oct 25 2005

A017113 a(n) = 8*n + 4.

Original entry on oeis.org

4, 12, 20, 28, 36, 44, 52, 60, 68, 76, 84, 92, 100, 108, 116, 124, 132, 140, 148, 156, 164, 172, 180, 188, 196, 204, 212, 220, 228, 236, 244, 252, 260, 268, 276, 284, 292, 300, 308, 316, 324, 332, 340, 348, 356, 364, 372, 380, 388, 396, 404, 412, 420, 428, 436, 444, 452, 460, 468
Offset: 0

Keywords

Comments

Apart from initial term(s), dimension of the space of weight 2n cuspidal newforms for Gamma_0(65).
n such that 16 is the largest power of 2 dividing A003629(k)^n - 1 for any k. - Benoit Cloitre, Mar 23 2002
Continued fraction expansion of tanh(1/4). - Benoit Cloitre, Dec 17 2002
Consider all primitive Pythagorean triples (a,b,c) with c - a = 8, sequence gives values for b. (Corresponding values for a are A078371(n), while c follows A078370(n).) - Lambert Klasen (Lambert.Klasen(AT)gmx.net), Nov 19 2004
Also numbers of the form a^2 + b^2 + c^2 + d^2, where a,b,c,d are odd integers. - Alexander Adamchuk, Dec 01 2006
If X is an n-set and Y_i (i=1,2,3) mutually disjoint 2-subsets of X then a(n-5) is equal to the number of 4-subsets of X intersecting each Y_i (i=1,2,3). - Milan Janjic, Aug 26 2007
A007814(a(n)) = 2; A037227(a(n)) = 5. - Reinhard Zumkeller, Jun 30 2012
Numbers k such that 3^k + 1 is divisible by 41. - Bruno Berselli, Aug 22 2018
Lexicographically smallest arithmetic progression of positive integers avoiding Fibonacci numbers. - Paolo Xausa, May 08 2023
From Martin Renner, May 24 2024: (Start)
Also number of points in a grid cross with equally long arms and a width of two points, e.g.:
* *
* * * *
* * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * *
* * * *
* *
etc. (End)

Crossrefs

First differences of A016742 (even squares).
Cf. A078370, A078371, A081770 (subsequence).

Programs

Formula

a(n) = A118413(n+1,3) for n > 2. - Reinhard Zumkeller, Apr 27 2006
a(n) = Sum_{k=0..4*n} (i^k+1)*(i^(4*n-k)+1), where i = sqrt(-1). - Bruno Berselli, Mar 19 2012
a(n) = 4*A005408(n). - Omar E. Pol, Apr 17 2016
E.g.f.: (8*x + 4)*exp(x). - G. C. Greubel, Apr 26 2018
G.f.: 4*(1+x)/(1-x)^2. - Wolfdieter Lang, Oct 27 2020
Sum_{n>=0} (-1)^n/a(n) = Pi/16 (A019683). - Amiram Eldar, Dec 11 2021
From Amiram Eldar, Nov 22 2024: (Start)
Product_{n>=0} (1 - (-1)^n/a(n)) = sqrt(2) * sin(3*Pi/16).
Product_{n>=0} (1 + (-1)^n/a(n)) = sqrt(2) * cos(3*Pi/16). (End)
a(n) = 2*A016825(n) = A008586(2*n+1). - Elmo R. Oliveira, Apr 10 2025

A014480 Expansion of g.f. (1+2*x)/(1-2*x)^2.

Original entry on oeis.org

1, 6, 20, 56, 144, 352, 832, 1920, 4352, 9728, 21504, 47104, 102400, 221184, 475136, 1015808, 2162688, 4587520, 9699328, 20447232, 42991616, 90177536, 188743680, 394264576, 822083584, 1711276032, 3556769792, 7381975040, 15300820992, 31675383808, 65498251264
Offset: 0

Keywords

Comments

Number of binary trees of size n and height n-1, computed from size n=3 onward; i.e. A014480(n) = A073345(n+3,n+2). (For sizes n=0 through 2 there are no such trees.)
Also determinant of the n X n matrix M(i,j)=binomial(2i+2j,i+j). - Benoit Cloitre, Mar 27 2004
Subdiagonal in triangle displayed in A128196. - Peter Luschny, Feb 26 2007
From Jaume Oliver Lafont, Nov 08 2009: (Start)
From two BBP-type formulas by Knuth, (page 6 of the reference)
Sum_{n>=0} 1/a(n) = 2^(1/2)*log(1+2^(1/2))
Sum_{n>=0} (-1)^n/a(n) = 2^(1/2)*atan(1/2^(1/2))
(End)
Create a triangle with first column T(n,1)=1+4*n for n=0 1 2... The remaining terms T(r,c)=T(r,c-1)+T(r-1,c-1). T(n,n+1)=a(n). - J. M. Bergot, Dec 18 2012

Examples

			(1 + 2*x)/(1-2*x)^2 = 1 + 6*x + 20*x^2 + 56*x^3 + 144*x^4 + 352*x^5 + 832*x^6 + ...
		

Crossrefs

Leftmost column of A167580 (shifted).

Programs

  • Haskell
    a014480 n = a014480_list !! n
    a014480_list = 1 : 6 : map (* 4)
       (zipWith (-) (tail a014480_list) a014480_list)
    -- Reinhard Zumkeller, Jan 22 2012
    
  • Magma
    [2^n*(2*n + 1): n in [0..35]]; // Vincenzo Librandi, Oct 20 2014
  • Maple
    a:=n-> sum(2^n*n^binomial(j,n)/2,j=1..n): seq(a(n),n=1..29); # Zerinvary Lajos, Apr 18 2009
  • Mathematica
    CoefficientList[ Series[(1 + 2*x)/(1 - 2*x)^2, {x, 0, 28}], x]
    LinearRecurrence[{4, -4}, {1, 6}, 29] (* Robert G. Wilson v, Dec 26 2012 *)
    Table[2^n (2*n + 1), {n, 0, 28}] (* Fred Daniel Kline, Oct 20 2014 *)
  • PARI
    Vec((1+2*x)/(1-2*x)^2+O(x^99)) \\ Charles R Greathouse IV, Sep 23 2012
    

Formula

a(n) = (2n+1)*2^n = 4a(n-1)-4a(n-2) = 4*A052951(n-1) = a(n-1)+A052951(n) = a(n-1)*(2+4/(2n-1)) = A054582(n, n). - Henry Bottomley, May 16 2001
E.g.f.: x*cosh(sqrt(2)*x) = x + 6x^3/3! + 20x^5/5! + 56x^7/7! +... - Ralf Stephan, Mar 03 2005
From Reinhard Zumkeller, Apr 27 2006: (Start)
a(n) = A118416(n+1,n+1) = A118413(n+1,n+1);
A001511(a(n)) = A003602(a(n));
A117303(a(n)) = a(n). (End)
Row sums of triangle A132775 - Gary W. Adamson, Aug 29 2007
Row sums of triangle A134233 - Gary W. Adamson, Oct 14 2007
From Johannes W. Meijer, Nov 23 2009: (Start)
a(n) = 3*a(n-1) - 2^(n-1)*(2*n-5) with a(0) = 1.
a(n) = 3*a(n-1) - 2*a(n-2) + 2^n with a(0) = 1 and a(1) = 6.
(End)
G.f.: -G(0) where G(k) = 1 - (2*k+2)/(1 - x/(x - (k+1)/G(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Dec 06 2012
E.g.f.: Q(0), where Q(k)= 1 + 4*x/( 1 - 1/(1 + 2*(k+1)/Q(k+1))); (continued fraction). - Sergei N. Gladkovskii, May 11 2013

A173786 Triangle read by rows: T(n,k) = 2^n + 2^k, 0 <= k <= n.

Original entry on oeis.org

2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 17, 18, 20, 24, 32, 33, 34, 36, 40, 48, 64, 65, 66, 68, 72, 80, 96, 128, 129, 130, 132, 136, 144, 160, 192, 256, 257, 258, 260, 264, 272, 288, 320, 384, 512, 513, 514, 516, 520, 528, 544, 576, 640, 768, 1024, 1025, 1026, 1028, 1032, 1040, 1056, 1088, 1152, 1280, 1536, 2048
Offset: 0

Author

Reinhard Zumkeller, Feb 28 2010

Keywords

Comments

Essentially the same as A048645. - T. D. Noe, Mar 28 2011

Examples

			Triangle begins as:
     2;
     3,    4;
     5,    6,    8;
     9,   10,   12,   16;
    17,   18,   20,   24,   32;
    33,   34,   36,   40,   48,   64;
    65,   66,   68,   72,   80,   96,  128;
   129,  130,  132,  136,  144,  160,  192,  256;
   257,  258,  260,  264,  272,  288,  320,  384,  512;
   513,  514,  516,  520,  528,  544,  576,  640,  768, 1024;
  1025, 1026, 1028, 1032, 1040, 1056, 1088, 1152, 1280, 1536, 2048;
		

Crossrefs

Programs

  • Magma
    [2^n + 2^k: k in [0..n], n in [0..12]]; // G. C. Greubel, Jul 07 2021
    
  • Mathematica
    Flatten[Table[2^n + 2^m, {n,0,10}, {m, 0, n}]] (* T. D. Noe, Jun 18 2013 *)
  • PARI
    A173786(n) = { my(c = (sqrtint(8*n + 1) - 1) \ 2); 1 << c + 1 << (n - binomial(c + 1, 2)); }; \\ Antti Karttunen, Feb 29 2024, after David A. Corneth's PARI-program in A048645
    
  • Python
    from math import isqrt, comb
    def A173786(n):
        a = (m:=isqrt(k:=n+1<<1))-(k<=m*(m+1))
        return (1<Chai Wah Wu, Jun 20 2025
  • Sage
    flatten([[2^n + 2^k for k in (0..n)] for n in (0..12)]) # G. C. Greubel, Jul 07 2021
    

Formula

1 <= A000120(T(n,k)) <= 2.
For n>0, 0<=kA048645(n+1,k+2) and T(n,n) = A048645(n+2,1).
Row sums give A006589(n).
Central terms give A161168(n).
T(2*n+1,n) = A007582(n+1).
T(2*n+1,n+1) = A028403(n+1).
T(n,k) = A140513(n,k) - A173787(n,k), 0<=k<=n.
T(n,k) = A059268(n+1,k+1) + A173787(n,k), 0
T(n,k) * A173787(n,k) = A173787(2*n,2*k), 0<=k<=n.
T(n,0) = A000051(n).
T(n,1) = A052548(n) for n>0.
T(n,2) = A140504(n) for n>1.
T(n,3) = A175161(n-3) for n>2.
T(n,4) = A175162(n-4) for n>3.
T(n,5) = A175163(n-5) for n>4.
T(n,n-4) = A110287(n-4) for n>3.
T(n,n-3) = A005010(n-3) for n>2.
T(n,n-2) = A020714(n-2) for n>1.
T(n,n-1) = A007283(n-1) for n>0.
T(n,n) = 2*A000079(n).

Extensions

Typo in first comment line fixed by Reinhard Zumkeller, Mar 07 2010

A058962 a(n) = 2^(2*n)*(2*n+1).

Original entry on oeis.org

1, 12, 80, 448, 2304, 11264, 53248, 245760, 1114112, 4980736, 22020096, 96468992, 419430400, 1811939328, 7784628224, 33285996544, 141733920768, 601295421440, 2542620639232, 10720238370816, 45079976738816, 189115999977472, 791648371998720
Offset: 0

Author

N. J. A. Sloane, Jan 13 2001

Keywords

Comments

Denominators in expansion of -1/2*i*Pi+i*arcsin((1+1/4*x^2)/(1-1/4*x^2)), where i=sqrt(-1); numerators are all 1.
Bisection of A001787. That is, a(n) = A001787(2n+1). - Graeme McRae, Jul 12 2006
Denominators of odd terms in expansion of 2*arctanh(s/2); numerators are all 1. - Gerry Martens, Jul 26 2015
Reciprocals of coefficients of Taylor series expansion of sinh(x/2) / (x/2). - Tom Copeland, Feb 03 2016

Crossrefs

Cf. A154920. - Jaume Oliver Lafont, Jan 29 2009
Factor of the LS1[-2,n] matrix coefficients in A160487. - Johannes W. Meijer, May 24 2009

Programs

  • Magma
    [2^(2*n)*(2*n+1) : n in [0..30]]; // Wesley Ivan Hurt, Aug 07 2015
    
  • Mathematica
    a[n_] := 1/SeriesCoefficient[2 ArcTanh[s/2],{s,0,n}]
    Table[a[n], {n, 1, 40, 2}] (* Gerry Martens, Jul 26 2015 *)
    Table[2^(2 n) (2 n + 1), {n, 0, 40}] (* Vincenzo Librandi, Aug 08 2015 *)
    a[ n_] := With[{m = 2 n + 2}, If[ n < 0, -a[-1 - n] 4^(m - 1), m! SeriesCoefficient[ x^2 D[x Sinc[I x]^2, x]/2, {x, 0, m}]]]; (* Michael Somos, Jun 18 2017 *)
  • PARI
    A058962(n)=2^(2*n)*(2*n+1) \\ M. F. Hasler, Aug 11 2015
    
  • PARI
    {a(n) = my(m = 2*n + 2); if( n<0, -a(-1 - n) * 4^(m - 1), m! * polcoeff( x^2 * deriv(x * sinc(I*x + x * O(x^m))^2, x) / 2, m))}; /* Michael Somos, Jun 18 2017 */

Formula

Central terms of the triangle in A118416: a(n) = A118416(2*n+1, n+1) - Reinhard Zumkeller, Apr 27 2006
Sum_{n>=0} 1/a(n) = log(3). - Jaume Oliver Lafont, May 22 2007; corrected by Jaume Oliver Lafont, Jan 26 2009
a(n) = 4((2n+1)/(2n-1))*a(n-1) = 4*a(n-1)+2^(2n+1) = 8*a(n-1)-16*a(n-2). - Jaume Oliver Lafont, Dec 09 2008
G.f.: (1+4*x)/(1-4*x)^2. - Jaume Oliver Lafont, Jan 29 2009
E.g.f.: exp(4*x)*(1+8*x). - Robert Israel, Aug 10 2015
a(n) = -a(-1-n) * 4^(2*n+1) for all n in Z. - Michael Somos, Jun 18 2017
a(n) = Sum_{k = 0..n} (2*k + 1)^2*binomial(2*n + 1, n - k). - Peter Bala, Feb 25 2019
Sum_{n>=0} (-1)^n/a(n) = 2 * arctan(1/2) = 2 * A073000. - Amiram Eldar, Jul 03 2020

A051062 a(n) = 16*n + 8.

Original entry on oeis.org

8, 24, 40, 56, 72, 88, 104, 120, 136, 152, 168, 184, 200, 216, 232, 248, 264, 280, 296, 312, 328, 344, 360, 376, 392, 408, 424, 440, 456, 472, 488, 504, 520, 536, 552, 568, 584, 600, 616, 632, 648, 664, 680, 696, 712, 728, 744, 760, 776, 792, 808, 824, 840
Offset: 0

Author

Keywords

Comments

Apart from initial term(s), dimension of the space of weight 2n cuspidal newforms for Gamma_0(97).
n such that 32 is the largest power of 2 dividing A003629(k)^n-1 for any k. - Benoit Cloitre, Mar 23 2002
Continued fraction expansion of tanh(1/8). - Benoit Cloitre, Dec 17 2002
If Y and Z are 2-blocks of a (4n+1)-set X then a(n-1) is the number of 3-subsets of X intersecting both Y and Z. - Milan Janjic, Oct 28 2007
General form: (q*n+x)*q x=+1; q=2=A016825, q=3=A017197, q=4=A119413, ... x=-1; q=3=A017233, q=4=A098502, ... x=+2; q=4=A051062, ... - Vladimir Joseph Stephan Orlovsky, Feb 16 2009
a(n)*n+1 = (4n+1)^2 and a(n)*(n+1)+1 = (4n+3)^2 are both perfect squares. - Carmine Suriano, Jun 01 2014
For all positive integers n, there are infinitely many positive integers k such that k*n + 1 and k*(n+1) + 1 are both perfect squares. Except for 8, all the numbers of this sequence are the smallest integers k which are solutions for getting two perfect squares. Example: a(1) = 24 and 24 * 1 + 1 = 25 = 5^2, then 24 * (1+1) + 1 = 49 = 7^2. [Reference AMM] - Bernard Schott, Sep 24 2017
Numbers k such that 3^k + 1 is divisible by 17*193. - Bruno Berselli, Aug 22 2018

References

  • Letter from Gary W. Adamson concerning Prouhet-Thue-Morse sequence, Nov 11 1999.

Programs

Formula

a(n) = A118413(n+1,4) for n>3. - Reinhard Zumkeller, Apr 27 2006
a(n) = 32*n - a(n-1) for n>0, a(0)=8. - Vincenzo Librandi, Aug 06 2010
A003484(a(n)) = 8; A209675(a(n)) = 9. - Reinhard Zumkeller, Mar 11 2012
A007814(a(n)) = 3; A037227(a(n)) = 7. - Reinhard Zumkeller, Jun 30 2012
a(-1 - n) = - a(n). - Michael Somos, Jun 02 2014
Sum_{n>=0} (-1)^n/a(n) = Pi/32 (A244978). - Amiram Eldar, Feb 28 2023
From Elmo R. Oliveira, Apr 16 2024: (Start)
G.f.: 8*(1+x)/(1-x)^2.
E.g.f.: 8*exp(x)*(1 + 2*x).
a(n) = 8*A005408(n) = A008598(n) + 8 = A139098(n+1) - A139098(n).
a(n) = 4*A016825(n) = 2*A017113(n) = 2*a(n-1) - a(n-2) for n >= 2. (End)
From Amiram Eldar, Nov 25 2024: (Start)
Product_{n>=0} (1 - (-1)^n/a(n)) = sqrt(2)*sin(7*Pi/32).
Product_{n>=0} (1 + (-1)^n/a(n)) = sqrt(2)*cos(7*Pi/32). (End)
Showing 1-10 of 17 results. Next