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 53 results. Next

A003159 Numbers whose binary representation ends in an even number of zeros.

Original entry on oeis.org

1, 3, 4, 5, 7, 9, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23, 25, 27, 28, 29, 31, 33, 35, 36, 37, 39, 41, 43, 44, 45, 47, 48, 49, 51, 52, 53, 55, 57, 59, 60, 61, 63, 64, 65, 67, 68, 69, 71, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 89, 91, 92, 93, 95, 97, 99, 100, 101, 103, 105
Offset: 1

Views

Author

Keywords

Comments

Fraenkel (2010) called these the "vile" numbers.
Minimal with respect to property that parity of number of 1's in binary expansion alternates.
Minimal with respect to property that sequence is half its complement. [Corrected by Aviezri S. Fraenkel, Jan 29 2010]
If k appears then 2k does not.
Increasing sequence of positive integers k such that A035263(k)=1 (from paper by Allouche et al.). - Emeric Deutsch, Jan 15 2003
a(n) is an odious number (see A000069) for n odd; a(n) is an evil number (see A001969) for n even. - Philippe Deléham, Mar 16 2004
Indices of odd numbers in A007913, in A001511. - Philippe Deléham, Mar 27 2004
Partial sums of A026465. - Paul Barry, Dec 09 2004
A121701(2*a(n)) = A121701(a(n)); A096268(a(n)-1) = 0. - Reinhard Zumkeller, Aug 16 2006
A different permutation of the same terms may be found in A141290 and the accompanying array. - Gary W. Adamson, Jun 14 2008
a(n) = n-th clockwise Tower of Hanoi move; counterclockwise if not in the sequence. - Gary W. Adamson, Jun 14 2008
Indices of terms of Thue-Morse sequence A010060 which are different from the previous term. - Tanya Khovanova, Jan 06 2009
The sequence has the following fractal property. Remove the odd numbers from the sequence, leaving 4,12,16,20,28,36,44,48,52,... Dividing these terms by 4 we get 1,3,4,5,7,9,11,12,..., which is the original sequence back again. - Benoit Cloitre, Apr 06 2010
From Gary W. Adamson, Mar 21 2010: (Start)
A conjectured identity relating to the partition sequence, A000041 as polcoeff p(x); A003159, and its characteristic function A035263: (1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, ...); and A036554 indicating n-th terms with zeros in A035263: (2, 6, 8, 10, 14, 18, 22, ...).
The conjecture states that p(x) = A(x) = A(x^2) when A(x) = polcoeff A174065 = the Euler transform of A035263 = 1/((1-x)*(1-x^3)*(1-x^4)*(1-x^5)*...) = 1 + x + x^2 + 2*x^3 + 3*x^4 + 4*x^5 + ... and the aerated variant = the Euler transform of the complement of A035263: 1/((1-x^2)*(1-x^6)*(1-x^8)*...) = 1 + x^2 + x^4 + 2*x^6 + 3*x^8 + 4*x^10 + ....
(End)
The conjecture above was proved by Jean-Paul Allouche on Dec 21 2013. - Gary W. Adamson, Jan 22 2014
If the lower s-Wythoff sequence of s is s, then s=A003159. (See A184117 for the definition of lower and upper s-Wythoff sequences.) Starting with any nondecreasing sequence s of positive integers, A003159 is the limit when the lower s-Wythoff operation is iterated. For example, starting with s=(1,4,9,16,...)=(n^2), we obtain lower and upper s-Wythoff sequences
a=(1,3,4,5,6,8,9,10,11,12,14,...)=A184427;
b=(2,7,12,21,31,44,58,74,...)=A184428.
Then putting s=a and repeating the operation gives a'=(1,3,4,5,7,9,11,12,14,...), which has the same first eight terms as A003159. - Clark Kimberling, Jan 14 2011

Examples

			1=1, 3=11, 5=101 and 7=111 have no (0 = even) trailing zeros, 4=100 has 2 (= even) trailing zeros in the base-2 representation.
2=10 and 6=110 end in one (=odd number) of trailing zeros in their base-2 representation, therefore are not terms of this sequence. - _M. F. Hasler_, Oct 29 2013
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

For the actual binary numbers see A280049.
Indices of even numbers in A007814.
Complement of A036554, also one-half of A036554.

Programs

  • Haskell
    import Data.List (delete)
    a003159 n = a003159_list !! (n-1)
    a003159_list = f [1..] where f (x:xs) = x : f (delete  (2*x) xs)
    -- Reinhard Zumkeller, Nov 04 2011
    
  • Maple
    filter:= n -> type(padic:-ordp(n,2),even):
    select(filter,[$1..1000]); # Robert Israel, Jul 07 2014
  • Mathematica
    f[n_Integer] := Block[{k = n, c = 0}, While[ EvenQ[k], c++; k /= 2]; c]; Select[ Range[105], EvenQ[ f[ # ]] & ]
    Select[Range[150],EvenQ[IntegerExponent[#,2]]&] (* Harvey P. Dale, Oct 19 2011 *)
  • PARI
    a(n)=if(n<2,n>0,n=a(n-1); until(valuation(n,2)%2==0,n++); n)
    
  • PARI
    is(n)=valuation(n,2)%2==0 \\ Charles R Greathouse IV, Sep 23 2012
    
  • Python
    from itertools import count, islice
    def A003159_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:(n&-n).bit_length()&1,count(max(startvalue,1)))
    A003159_list = list(islice(A003159_gen(),30)) # Chai Wah Wu, Jul 11 2022
    
  • Python
    def A003159(n):
        def f(x):
            c, s = n+x, bin(x)[2:]
            l = len(s)
            for i in range(l&1^1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Jan 29 2025

Formula

a(0) = 1; for n >= 0, a(n+1) = a(n) + 1 if (a(n) + 1)/2 is not already in the sequence, = a(n) + 2 otherwise.
Limit_{n->oo} a(n)/n = 3/2. - Benoit Cloitre, Jun 13 2002
More precisely, a(n) = 3*n/2 + O(log n). - Charles R Greathouse IV, Sep 23 2012
a(n) = Sum_{k = 1..n} A026465(k). - Benoit Cloitre, May 31 2003
a(n+1) = (if a(n) mod 4 = 3 then A007814(a(n) + 1) mod 2 else a(n) mod 2) + a(n) + 1; a(1) = 1. - Reinhard Zumkeller, Aug 03 2003
a(A003157(n)) is even. - Philippe Deléham, Feb 22 2004
Sequence consists of numbers of the form 4^i*(2*j + 1), i>=0, j>=0. - Jon Perry, Jun 06 2004
G.f.: (1/(1-x)) * Product_{k >= 1} (1 + x^A001045(k)). - Paul Barry, Dec 09 2004
a(1) = 1, a(2) = 3, and for n >= 2 we get a(n+1) = 4 + a(n) + a(n-1) - a(a(n)-n+1) - a(a(n-1)-n+2). - Benoit Cloitre, Apr 08 2010
If A(x) is the counting function for a(n) <= x, then A(2^n) = (2^(n+1) + (-1)^n)/3. - Vladimir Shevelev, Apr 15 2010
a(n) = A121539(n) + 1. - Reinhard Zumkeller, Mar 01 2012
A003159 = { N | A007814(N) is even }. - M. F. Hasler, Oct 29 2013

Extensions

Additional comments from Michael Somos
Edited by M. F. Hasler, Oct 29 2013
Incorrect formula removed by Peter Munn, Dec 04 2020

A036554 Numbers whose binary representation ends in an odd number of zeros.

Original entry on oeis.org

2, 6, 8, 10, 14, 18, 22, 24, 26, 30, 32, 34, 38, 40, 42, 46, 50, 54, 56, 58, 62, 66, 70, 72, 74, 78, 82, 86, 88, 90, 94, 96, 98, 102, 104, 106, 110, 114, 118, 120, 122, 126, 128, 130, 134, 136, 138, 142, 146, 150, 152, 154, 158, 160, 162, 166, 168, 170, 174
Offset: 1

Views

Author

Keywords

Comments

Fraenkel (2010) called these the "dopey" numbers.
Also n such that A035263(n)=0 or A050292(n) = A050292(n-1).
Indices of even numbers in A033485. - Philippe Deléham, Mar 16 2004
a(n) is an odious number (see A000069) for n odd; a(n) is an evil number (see A001969) for n even. - Philippe Deléham, Mar 16 2004
Indices of even numbers in A007913, in A001511. - Philippe Deléham, Mar 27 2004
This sequence consists of the increasing values of n such that A097357(n) is even. - Creighton Dement, Aug 14 2004
Numbers with an odd number of 2's in their prime factorization (e.g., 8 = 2*2*2). - Mark Dow, Sep 04 2007
Equals the set of natural numbers not in A003159 or A141290. - Gary W. Adamson, Jun 22 2008
Represents the set of CCW n-th moves in the standard Tower of Hanoi game; and terms in even rows of a [1, 3, 5, 7, 9, ...] * [1, 2, 4, 8, 16, ...] multiplication table. Refer to the example. - Gary W. Adamson, Mar 20 2010
Refer to the comments in A003159 relating to A000041 and A174065. - Gary W. Adamson, Mar 21 2010
If the upper s-Wythoff sequence of s is s, then s=A036554. (See A184117 for the definition of lower and upper s-Wythoff sequences.) Starting with any nondecreasing sequence s of positive integers, A036554 is the limit when the upper s-Wythoff operation is iterated. For example, starting with s=(1,4,9,16,...) = (n^2), we obtain lower and upper s-Wythoff sequences
a=(1,3,4,5,6,8,9,10,11,12,14,...) = A184427;
b=(2,7,12,21,31,44,58,74,...) = A184428.
Then putting s=a and repeating the operation gives
b'=(2,6,8,10,13,17,20,...), which has the same first four terms as A036554. - Clark Kimberling, Jan 14 2011
Or numbers having infinitary divisor 2, or the same, having factor 2 in Fermi-Dirac representation as a product of distinct terms of A050376. - Vladimir Shevelev, Mar 18 2013
Thus, numbers not in A300841 or in A302792. Equally, sequence 2*A300841(n) sorted into ascending order. - Antti Karttunen, Apr 23 2018

Examples

			From _Gary W. Adamson_, Mar 20 2010: (Start)
Equals terms in even numbered rows in the following multiplication table:
(rows are labeled 1,2,3,... as with the Towers of Hanoi disks)
   1,  3,  5,  7,  9, 11, ...
   2,  6, 10, 14, 18, 22, ...
   4, 12, 20, 28, 36, 44, ...
   8, 24, 40, 56, 72, 88, ...
   ...
As shown, 2, 6, 8, 10, 14, ...; are in even numbered rows, given the row with (1, 3, 5, 7, ...) = row 1.
The term "5" is in an odd row, so the 5th Towers of Hanoi move is CW, moving disc #1 (in the first row).
a(3) = 8 in row 4, indicating that the 8th Tower of Hanoi move is CCW, moving disc #4.
A036554 bisects the positive nonzero natural numbers into those in the A036554 set comprising 1/3 of the total numbers, given sufficiently large n.
This corresponds to 1/3 of the TOH moves being CCW and 2/3 CW. Row 1 of the multiplication table = 1/2 of the natural numbers, row 2 = 1/4, row 3 = 1/8 and so on, or 1 = (1/2 + 1/4 + 1/8 + 1/16 + ...). Taking the odd-indexed terms of this series given offset 1, we obtain 2/3 = 1/2 + 1/8 + 1/32 + ..., while sum of the even-indexed terms is 1/3. (End)
		

Crossrefs

Indices of odd numbers in A007814. Subsequence of A036552. Complement of A003159. Also double of A003159.
Cf. A000041, A003157, A003158, A005408, A052330, A072939, A079523, A096268 (characteristic function, when interpreted with offset 1), A141290, A174065, A300841.

Programs

  • Haskell
    a036554 = (+ 1) . a079523  -- Reinhard Zumkeller, Mar 01 2012
    
  • Magma
    [2*m:m in [1..100] | Valuation(m,2) mod 2 eq 0]; // Marius A. Burtea, Aug 29 2019
    
  • Mathematica
    Select[Range[200],OddQ[IntegerExponent[#,2]]&] (* Harvey P. Dale, Oct 19 2011 *)
  • PARI
    is(n)=valuation(n,2)%2 \\ Charles R Greathouse IV, Nov 20 2012
    
  • Python
    def ok(n):
      c = 0
      while n%2 == 0: n //= 2; c += 1
      return c%2 == 1
    print([m for m in range(1, 175) if ok(m)]) # Michael S. Branicky, Feb 06 2021
    
  • Python
    from itertools import count, islice
    def A036554_gen(startvalue=1): return filter(lambda n:(~n & n-1).bit_length()&1,count(max(startvalue,1))) # generator of terms >= startvalue
    A036554_list = list(islice(A036554_gen(),30)) # Chai Wah Wu, Jul 05 2022
    
  • Python
    is_A036554 = lambda n: A001511(n)&1==0 # M. F. Hasler, Nov 26 2024
    
  • Python
    def A036554(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c, s = n+x, bin(x)[2:]
            l = len(s)
            for i in range(l&1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        return bisection(f,n,n) # Chai Wah Wu, Jan 29 2025

Formula

a(n) = A079523(n)+1 = A072939(n)-1.
a(n) = A003156(n) + n = A003157(n) - n = A003158(n) - n + 1. - Philippe Deléham, Apr 10 2004
Values of k such that A091297(k) = 2. - Philippe Deléham, Feb 25 2004
a(n) ~ 3n. - Charles R Greathouse IV, Nov 20 2012 [In fact, a(n) = 3n + O(log n). - Charles R Greathouse IV, Nov 27 2024]
a(n) = 2*A003159(n). - Clark Kimberling, Sep 30 2014
{a(n)} = A052330({A005408(n)}), where {a(n)} denotes the set of integers in the sequence. - Peter Munn, Aug 26 2019

Extensions

Incorrect equation removed from formula by Peter Munn, Dec 04 2020

A136119 Limiting sequence when we start with the positive integers (A000027) and delete in step n >= 1 the term at position n + a(n).

Original entry on oeis.org

1, 3, 4, 5, 7, 8, 10, 11, 13, 14, 15, 17, 18, 20, 21, 22, 24, 25, 27, 28, 29, 31, 32, 34, 35, 37, 38, 39, 41, 42, 44, 45, 46, 48, 49, 51, 52, 54, 55, 56, 58, 59, 61, 62, 63, 65, 66, 68, 69, 71, 72, 73, 75, 76, 78, 79, 80, 82, 83, 85, 86, 87, 89, 90, 92, 93, 95, 96, 97, 99, 100
Offset: 1

Views

Author

Ctibor O. Zizka, Mar 16 2008

Keywords

Comments

Apparently a(n) = A001953(n-1)+1 = floor((n-1/2)*sqrt(2))+1 (confirmed for n < 20000) and a(n+1) - a(n) = A001030(n). From the definitions these conjectures are by no means obvious. Can they be proved? - Klaus Brockhaus, Apr 15 2008 [For an affirmative answer, see the Cloitre link.]
This is the s(n)-Wythoff sequence for s(n)=2n-1; see A184117 for the definition. Complement of A184119. - Clark Kimberling, Jan 09 2011

Examples

			First few steps are:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,...
n = 1; delete term at position 1+a(1) = 2: 2;
1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,...
n = 2; delete term at position 2+a(2) = 5: 6;
1,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,...
n = 3; delete term at position 3+a(3) = 7: 9;
1,3,4,5,7,8,10,11,12,13,14,15,16,17,18,19,20,...
n = 4; delete term at position 4+a(4) = 9: 12;
1,3,4,5,7,8,10,11,13,14,15,16,17,18,19,20,...
n = 5; delete term at position 5+a(5) = 12: 16;
1,3,4,5,7,8,10,11,13,14,15,17,18,19,20,...
n = 6; delete term at position 6+a(6) = 14: 19;
1,3,4,5,7,8,10,11,13,14,15,17,18,20,...
		

References

  • B. Cloitre, The golden sieve, preprint 2008

Crossrefs

Cf. A000027, A001953 (floor((n+1/2)*sqrt(2))), A001030 (fixed under 1 -> 21, 2 -> 211), A136110, A137292.
Cf. A242535.
Cf. A000217 (T).

Programs

  • Haskell
    import Data.List (delete)
    a136119 n = a136119_list !! (n-1)
    a136119_list = f [1..] where
       f zs@(y:xs) = y : f (delete (zs !! y) xs)
    -- Reinhard Zumkeller, May 17 2014
    
  • Magma
    [Ceiling((n-1/2)*Sqrt(2)): n in [1..100]]; // Vincenzo Librandi, Jul 01 2019
    
  • Mathematica
    f[0] = Range[100]; f[n_] := f[n] = Module[{pos = n + f[n-1][[n]]}, If[pos > Length[f[n-1]], f[n-1], Delete[f[n-1], pos]]]; f[1]; f[n = 2]; While[f[n] != f[n-1], n++]; f[n] (* Jean-François Alcover, May 08 2019 *)
    T[n_] := n (n + 1)/2; Table[1 + 2 Sqrt[T[n-1]] , {n, 1, 71}] // Floor (* Ralf Steiner, Oct 23 2019 *)
  • PARI
    apply( {A136119(n)=sqrtint(n*(n-1)*2)+1}, [1..99]) \\ M. F. Hasler, Jul 04 2022

Formula

a(n) = ceiling((n-1/2)*sqrt(2)). This can be proved in the same way as the formula given for A099267. There are some generalizations. For instance, it is possible to consider "a(n)+K*n" instead of "a(n)+n" for deleting terms where K=0,1,2,... is fixed. The constant involved in the Beatty sequence for the sequence of deleted terms then depends on K and equals (K + 1 + sqrt((K+1)^2 + 4))/2. K=0 is related to A099267. 1+A001954 is the complement sequence of this sequence A136119. - Benoit Cloitre, Apr 18 2008
a(n) = floor(1 + 2*sqrt(T(n-1))), with triangular numbers T(). - Ralf Steiner, Oct 23 2019
Lim_{n->inf}(a(n)/(n - 1)) = sqrt(2), with {a(n)/(n - 1)} decreasing. - Ralf Steiner, Oct 24 2019

Extensions

Edited and extended by Klaus Brockhaus, Apr 15 2008
An incorrect g.f. removed by Alois P. Heinz, Dec 14 2012

A026274 Greatest k such that s(k) = n, where s = A026272.

Original entry on oeis.org

3, 5, 8, 11, 13, 16, 18, 21, 24, 26, 29, 32, 34, 37, 39, 42, 45, 47, 50, 52, 55, 58, 60, 63, 66, 68, 71, 73, 76, 79, 81, 84, 87, 89, 92, 94, 97, 100, 102, 105, 107, 110, 113, 115, 118, 121, 123, 126, 128, 131, 134, 136, 139, 141, 144
Offset: 1

Views

Author

Keywords

Comments

This is the upper s-Wythoff sequence, where s(n)=n+1.
See comments at A026273.
Conjecture: This sequence consists precisely of those numbers without a 1 or 2 in their Zeckendorf representation. [In other words, numbers which are the sum of distinct nonconsecutive Fibonacci numbers greater than 2.] - Charles R Greathouse IV, Jan 28 2015
A Beatty sequence with complement A026273. - Robert G. Wilson v, Jan 30 2015
A035612(a(n)+1) = 1. - Reinhard Zumkeller, Jul 20 2015
From Michel Dekking, Mar 12 2018: (Start)
One has r*r*(n-2*r+3) = n*r^2 -2r^3+3*r^2 = (n+1)*r^2 -2, where r = (1+sqrt(5))/2.
So a(n) = floor((n+1)*r^2)-2, and we see that this sequence is simply the Beatty sequence of the square of the golden ratio, shifted spatially and temporally. In other words, if w = A001950 = 2,5,7,10,13,15,18,20,... is the upper Wythoff sequence, then a(n) = w(n+1) - 2.
(End)
From Michel Dekking, Apr 05 2020: (Start)
Proof of the conjecture by Charles R Greathouse IV.
Let Z(n) = d(L)...d(1)d(0) be the Zeckendorf expansion of n. Well-known is:
d(0) = 1 if and only if n = floor(k*r^2) - 1
for some integer k (see A003622).
Then the same characterization holds for n with d(1)d(0) = 01, since 11 does not appear in a Zeckendorf expansion. But such an n has predecessor n-1 which always has an expansion with d(1)d(0) = 00. Combined with my comment from March 2018, this proves the conjecture (ignoring n = 0). (End)
It appears that these are the integers m for which A007895(m+1) > A007895(m) where A007895(m) is the number of terms in Zeckendorf representation of m. - Michel Marcus, Oct 30 2020
This follows directly from Theorem 4 in my paper "Points of increase of the sum of digits function of the base phi expansion". - Michel Dekking, Oct 31 2020

Crossrefs

Programs

  • Haskell
    a026274 n = a026274_list !! (n-1)
    a026274_list = map (subtract 1) $ tail $ filter ((== 1) . a035612) [1..]
    -- Reinhard Zumkeller, Jul 20 2015
    
  • Mathematica
    r=(1+Sqrt[5])/2;
    a[n_]:=Floor[r*r*(n+2r-3)];
    Table[a[n],{n,200}]
    Table[Floor[GoldenRatio^2 (n+2*GoldenRatio-3)],{n,60}] (* Harvey P. Dale, Dec 23 2022 *)
  • PARI
    a(n)=my(w=quadgen(20),phi=(1+w)/2); phi^2*(n+2*phi-3)\1 \\ Charles R Greathouse IV, Nov 10 2021
    
  • Python
    from math import isqrt
    def A026274(n): return (n+1+isqrt(5*(n+1)**2)>>1)+n-1 # Chai Wah Wu, Aug 17 2022

Formula

a(n) = floor(r*r*(n+2r-3)), where r = (1+sqrt(5))/2 = A001622. [Corrected by Tom Edgar, Jan 30 2015]
a(n) = 3*n - floor[(n+1)/(1+phi)], phi = (1+sqrt(5))/2. - Joshua Tobin (tobinrj(AT)tcd.ie), May 31 2008
a(n) = A003622(n+1) - 1 for n>1 (conjectured). - Michel Marcus, Oct 30 2020
This conjectured formula follows directly from the formula a(n) = floor((n+1)*r^2)-2 in my Mar 12 2018 comment above. - Michel Dekking, Oct 31 2020

Extensions

Extended by Clark Kimberling, Jan 14 2011

A004201 Accept one, reject one, accept two, reject two, ...

Original entry on oeis.org

1, 3, 4, 7, 8, 9, 13, 14, 15, 16, 21, 22, 23, 24, 25, 31, 32, 33, 34, 35, 36, 43, 44, 45, 46, 47, 48, 49, 57, 58, 59, 60, 61, 62, 63, 64, 73, 74, 75, 76, 77, 78, 79, 80, 81, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 133, 134, 135
Offset: 1

Views

Author

Alexander Stasinski

Keywords

Comments

a(n) are the numbers satisfying m - 0.5 < sqrt(a(n)) <= m for some positive integer m. - Floor van Lamoen, Jul 24 2001
Lower s(n)-Wythoff sequence (as defined in A184117) associated to s(n) = A002024(n) = floor(1/2+sqrt(2n)), with complement (upper s(n)-Wythoff sequence) in A004202.

Crossrefs

Programs

  • Haskell
    a004201 n = a004201_list !! (n-1)
    a004201_list = f 1 [1..] where
       f k xs = us ++ f (k + 1) (drop (k) vs) where (us, vs) = splitAt k xs
    -- Reinhard Zumkeller, Jun 20 2015, Feb 12 2011
    
  • Mathematica
    f[x_]:=Module[{c=1-x+x^2},Range[c,c+x-1]]; Flatten[Array[f,20]] (* Harvey P. Dale, Jul 31 2012 *)
  • PARI
    A004201(n)=n+(n=(sqrtint(8*n-7)+1)\2)*(n-1)\2  \\ M. F. Hasler, Feb 13 2011
    
  • Python
    from math import comb, isqrt
    def A004201(n): return n+comb((m:=isqrt(k:=n<<1))+(k>m*(m+1)),2) # Chai Wah Wu, Nov 09 2024

Formula

a(n) = A061885(n-1)+1. - Franklin T. Adams-Watters, Jul 05 2009
a(n+1) - a(n) = A130296(n+1). - Reinhard Zumkeller, Jul 16 2008
a(A000217(n)) = n^2. - Reinhard Zumkeller, Feb 12 2011
a(n) = A004202(n)-A002024(n). - M. F. Hasler, Feb 13 2011
a(n) = n+A000217(A003056(n-1)) = n+A000217(A002024(n)-1). - M. F. Hasler, Feb 13 2011
a(n) = n + t(t+1)/2, where t = floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 13 2012
a(n) = (2*n - r + r^2)/2, where r = round(sqrt(2*n)). - Wesley Ivan Hurt, Sep 20 2021

A004202 Skip 1, take 1, skip 2, take 2, skip 3, take 3, etc.

Original entry on oeis.org

2, 5, 6, 10, 11, 12, 17, 18, 19, 20, 26, 27, 28, 29, 30, 37, 38, 39, 40, 41, 42, 50, 51, 52, 53, 54, 55, 56, 65, 66, 67, 68, 69, 70, 71, 72, 82, 83, 84, 85, 86, 87, 88, 89, 90, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132
Offset: 1

Views

Author

Alexander Stasinski

Keywords

Comments

a(n) are the numbers satisfying m < sqrt(a(n)) < m + 0.5 for some integer m. - Floor van Lamoen, Jul 24 2001
a(A000217(n)) = A002378(n). [Reinhard Zumkeller, Feb 12 2011]
Complement of A004201. Upper s(n)-Wythoff sequence (as defined in A184117), for s(n)=A002024(n)=floor[1/2+sqrt(2n)]. I.e., A004202(n) = A002024(n) + A004201(n), with A004201(1)=1 and for n>1, A004201(n) = least positive integer not yet in (A004201(1..n-1) union A004202(1..n-1)). - M. F. Hasler (following observations from R. J. Mathar), Feb 13 2011
Positions of record values in A256188 that are greater than 1: A014132(n) = A256188(a(n)). - Reinhard Zumkeller, Mar 26 2015

Examples

			Interpretation as  Wythoff sequence (from _Clark Kimberling_):
s = (1,2,2,3,3,3,4,4,4,4...) = A002024 (n n's);
a = (1,3,4,7,8,9,13,14,...) = A004201 = least number > 0 not yet in a or b;
b = (2,5,6,10,11,12,17,18,...) = A004202 = a+s.
From _Michael Somos_, May 03 2019: (Start)
As a triangular array
  2;
  5,  6;
  10, 11, 12;
  17, 18, 19, 20;
(End)
		

Crossrefs

Programs

  • Haskell
    a004202 n = a004202_list !! (n-1)
    a004202_list = skipTake 1 [1..] where
       skipTake k xs = take k (drop k xs) ++ skipTake (k + 1) (drop (2*k) xs)
    -- Reinhard Zumkeller, Feb 12 2011
    
  • Mathematica
    a = Table[n, {n, 1, 210} ]; b = {}; Do[a = Drop[a, {1, n} ]; b = Append[b, Take[a, {1, n} ]]; a = Drop[a, {1, n} ], {n, 1, 14} ]; Flatten[b]
    a[ n_] := If[ n < 1, 0, With[{m = Round@Sqrt[2 n]}, n + m (m + 1)/2]]; (* Michael Somos, May 03 2019 *)
    Take[#,(-Length[#])/2]&/@Module[{nn=20},TakeList[Range[ nn+nn^2],2*Range[ nn]]]//Flatten (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 13 2019 *)
  • PARI
    A004202(n) = n+0+(n=(sqrtint(8*n-7)+1)\2)*(n+1)\2  \\ M. F. Hasler, Feb 13 2011
    
  • PARI
    {a(n) = my(m); if( n<1, 0, m=round(sqrt(2*n)); n + m*(m+1)/2)}; /* Michael Somos, May 03 2019 */
    
  • Python
    from math import isqrt, comb
    def A004202(n): return n+comb((m:=isqrt(k:=n<<1))+(k-m*(m+1)>=1)+1,2) # Chai Wah Wu, Jun 19 2024

Formula

a(n) = n + A000217(A002024(n)). - M. F. Hasler, Feb 13 2011
T(n, k) = n^2 + k, for n>=1, k>=1 as a triangular array. a(n) = n + A127739(n). - Michael Somos, May 03 2019

A184119 Upper s(n)-Wythoff sequence, where s(n) = 2n - 1; complement of A136119.

Original entry on oeis.org

2, 6, 9, 12, 16, 19, 23, 26, 30, 33, 36, 40, 43, 47, 50, 53, 57, 60, 64, 67, 70, 74, 77, 81, 84, 88, 91, 94, 98, 101, 105, 108, 111, 115, 118, 122, 125, 129, 132, 135, 139, 142, 146, 149, 152, 156, 159, 163, 166, 170, 173, 176, 180, 183, 187, 190, 193, 197, 200, 204, 207, 210, 214, 217, 221, 224, 228, 231, 234, 238, 241, 245, 248, 251, 255, 258, 262, 265, 269, 272, 275, 279, 282, 286, 289, 292, 296, 299, 303, 306, 309, 313, 316, 320, 323, 327, 330, 333, 337, 340
Offset: 1

Views

Author

Clark Kimberling, Jan 09 2011

Keywords

Comments

See A184117 for the definition of lower and upper s(n)-Wythoff sequences.
(a(n)) is an inhomogeneous Beatty sequence, the complement of the inhomogeneous Beatty sequence (A136119(n)) = (floor(sqrt(2)*n + 1 - sqrt(2)/2)). See the paper by Fraenkel. - Michel Dekking, Jan 31 2017

Crossrefs

Programs

  • Magma
    [Floor((2+Sqrt(2))*n-Sqrt(2)/2): n in [1..80]]; // Vincenzo Librandi, Jan 31 2017
  • Mathematica
    k=2; r=1;
    mex:=First[Complement[Range[1, Max[#1]+1], #1]]&;
    s[n_]:=k*n-r; a[1]=1; b[n_]:=b[n]=s[n]+a[n];
    a[n_]:=a[n]=mex[Flatten[Table[{a[i], b[i]},{i, 1, n-1}]]];
    Table[s[n], {n, 30}]
    Table[a[n], {n, 100}]
    Table[b[n], {n, 100}]
    Table[(Floor[(2 + Sqrt[2]) n - Sqrt[2]/2]), {n, 100}] (* Vincenzo Librandi, Jan 31 2017 *)

Formula

a(n) = floor((2+sqrt(2))*n - sqrt(2)/2). - Michel Dekking, Jan 31 2017

A026273 a(n) = least k such that s(k) = n, where s = A026272.

Original entry on oeis.org

1, 2, 4, 6, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 23, 25, 27, 28, 30, 31, 33, 35, 36, 38, 40, 41, 43, 44, 46, 48, 49, 51, 53, 54, 56, 57, 59, 61, 62, 64, 65, 67, 69, 70, 72, 74, 75, 77, 78, 80, 82, 83, 85, 86, 88, 90, 91, 93, 95, 96, 98, 99
Offset: 1

Views

Author

Keywords

Comments

This is the lower s-Wythoff sequence, where s(n)=n+1.
See A184117 for the definition of lower and upper s-Wythoff sequences. The first few terms of a and its complement, b=A026274, are obtained generated as follows:
s=(2,3,4,5,6,...);
a=(1,2,4,6,7,...)=A026273;
b=(3,5,8,11,13,...)=A026274.
Briefly: b=s+a, and a=mex="least missing".
From Michel Dekking, Mar 12 2018: (Start)
One has r*(n-2*r+3) = n*r-2r^2+3*r = (n+1)*r-2.
So a(n) = (n+1)*r-2, and we see that this sequence is simply the Beatty sequence of the golden ratio, shifted spatially and temporally. In other words: if w = A000201 = 1,3,4,6,8,9,11,12,14,... is the lower Wythoff sequence, then a(n) = w(n+2) - 2.
(N.B. As so often, there is the 'offset 0 vs 1 argument', w = A000201 has offset 1; it would have been better to give (a(n)) offset 1, too).
This observation also gives an answer to Lenormand's question, and a simple proof of Mathar's conjecture in A059426.
(End)

Crossrefs

Programs

  • Mathematica
    r=(1+Sqrt[5])/2;
    a[n_]:=Floor[r*(n-2r+3)];
    b[n_]:=Floor[r*r*(n+2r-3)];
    Table[a[n],{n,200}]   (* A026273 *)
    Table[b[n],{n,200}]   (* A026274 *)

Formula

a(n) = floor[r*(n-2*r+3)], where r=golden ratio.
b(n) = floor[(r^2)*(n+2*r-3)] = floor(n*A104457-A134972+1).

Extensions

Extended by Clark Kimberling, Jan 14 2011

A184413 Lower s(n)-Wythoff sequence, where s(n)=floor[(n+1)/2]; complement of A184414.

Original entry on oeis.org

1, 3, 5, 6, 9, 10, 11, 14, 16, 17, 19, 20, 23, 24, 27, 28, 29, 32, 33, 34, 37, 39, 40, 42, 45, 46, 47, 49, 51, 53, 55, 56, 57, 60, 62, 64, 65, 67, 69, 70, 73, 75, 76, 78, 79, 81, 83, 85, 87, 88, 91, 92, 93, 95, 97, 99, 101, 103, 105, 106, 108, 110, 111, 114, 115, 116, 119, 121, 123, 124, 126, 128, 129, 131, 133, 134, 137, 138, 140, 142, 144, 145, 147, 150, 151, 152, 154, 156, 157, 160, 161, 163, 165, 167, 169, 170, 173, 174, 175, 178
Offset: 1

Views

Author

Clark Kimberling, Jan 13 2011

Keywords

Comments

See A184117 for the definition of lower and upper s(n)-Wythoff sequences.

Examples

			s=(1,1,2,2,3,3,4,4,5,5,6,6,7,7,...)=A004526;
a=(1,3,5,6,9,10,11,14,16,17,19,...)=A184413;
b=(2,4,7,8,12,13,15,18,21,22,25,...)=A184414;
Briefly: b=s+a; where a(n)=mex="least missing".
		

Crossrefs

Programs

  • Mathematica
    mex:=First[Complement[Range[1,Max[#1]+1],#1]]&;
    s[n_]:=Floor[(n+1)/2];a[1]=1;b[n_]:=b[n]=s[n]+a[n];
    a[n_]:=a[n]=mex[Flatten[Table[{a[i],b[i]},{i,1,n-1}]]];
    Table[s[n],{n,20}]
    Table[a[n],{n,100}]
    Table[b[n],{n,100}]

A184480 Lower s-Wythoff sequence, where s(n)=3n. Complement of A001956.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 35, 36, 37, 39, 40, 41, 42, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56, 57, 58, 59, 61, 62, 63, 65, 66, 67, 69, 70, 71, 72, 74, 75, 76, 78, 79, 80, 82, 83, 84, 85, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 115, 117, 118, 119, 121, 122, 123, 125, 126, 127, 128, 130, 131, 132, 134, 135, 136, 138, 139, 140, 142, 143, 144, 145, 147, 148, 149, 151, 152, 153, 155, 156
Offset: 1

Views

Author

Clark Kimberling, Jan 15 2011

Keywords

Comments

A184480(n)=A001955(n) for n<43.
See A184117 for the definition of lower and upper Wythoff sequences.

Crossrefs

Cf. A184117.

Programs

  • Mathematica
    k=3; r=0; d=Sqrt[4+k^2];
    a[n_]:=Floor[(1/2)(d+2-k)(n+r/(d+2))];
    b[n_]:=Floor[(1/2)(d+2+k)(n-r/(d+2))];
    Table[a[n],{n,120}]
    Table[b[n],{n,120}]

Formula

a(n)=floor[n*(-1+sqrt(13))/2].
b(n)=floor[n*(5+sqrt(13))/2]=A001956(n).
Showing 1-10 of 53 results. Next