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-2 of 2 results.

A036552 List of pairs (m,2m) where m is the least unused positive number.

Original entry on oeis.org

1, 2, 3, 6, 4, 8, 5, 10, 7, 14, 9, 18, 11, 22, 12, 24, 13, 26, 15, 30, 16, 32, 17, 34, 19, 38, 20, 40, 21, 42, 23, 46, 25, 50, 27, 54, 28, 56, 29, 58, 31, 62, 33, 66, 35, 70, 36, 72, 37, 74, 39, 78, 41, 82, 43, 86, 44, 88, 45, 90, 47, 94, 48, 96, 49, 98, 51, 102
Offset: 1

Views

Author

Keywords

Comments

A permutation of the natural numbers. Inverse permutation is A065037.

Crossrefs

Alternating merge of A003159 and A036554. Cf. A064736, A065037.

Programs

  • Haskell
    import Data.List (delete)
    a036552 n = a036552_list !! (n-1)
    a036552_list = g [1..] where
       g (x:xs) = x : (2*x) : (g $ delete (2*x) xs)
    -- Reinhard Zumkeller, Feb 07 2011
    
  • Mathematica
    w = {}; Do[ w = If[ FreeQ[w, k], w = Join[w, {k, 2k}], w], {k, 100}]; w
    (* Jean-François Alcover, Nov 04 2011, after Wouter Meeussen *)
  • PARI
    apairs(N) = my(m=0, r=List(), i=0); while(#rRuud H.G. van Tol, May 09 2024

A091297 A fixed point of the morphism 0 -> 02, 1 -> 02, 2 -> 11, starting from 0.

Original entry on oeis.org

0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 0, 2, 0
Offset: 1

Views

Author

Philippe Deléham, Feb 24 2004

Keywords

Comments

To construct the sequence: start from the Feigenbaum sequence A035263 = 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, ..., then change 1 -> 0, 2 and 0 -> 1, 1. - Philippe Deléham, Apr 18 2004
This Feigenbaum interpretation is equivalent to writing n+1 = binary "...1 00..00 x" where x is the least significant bit and zero or more 0's. If an odd number of 0's then a(n) = 1, otherwise a(n) = 2*x. In a similar way, if n-1 = binary "...0 11..11 x" with an odd number of 1's then a(n)=1 and otherwise a(n) = 2*x. - Kevin Ryde, Oct 17 2020
From Mikhail Kurkov, Mar 25 2021: (Start)
This sequence can be represented as a binary tree. Each child to the right is obtained by applying mex to the parent, and each child to the left is obtained by applying mex to the set formed by the parent and its second child:
( )
|
...................0...................
2 1
1......../ \........0 2......../ \........0
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
2 0 2 1 1 0 2 1
1 0 2 1 1 0 2 0 2 0 2 1 1 0 2 0
etc.
Here mex means smallest nonnegative missing number.
Each parent and its two children form a set {0,1,2}. (End)

Crossrefs

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 2}, 1 -> {0, 2}, 2 -> {1, 1}}) ]}], {0}, 7] (* Robert G. Wilson v, Mar 03 2005 *)
  • PARI
    a(n)={while(1, my(m=logint(n,2)); if(n==2*2^m-1, return(m%2)); if(n==2^m, return(1 + m%2)); n-=2^m)} \\ Andrew Howroyd, Oct 17 2020
    
  • PARI
    a(n) = n++; my(k=valuation(n>>1,2)); if(k%2==1, 1, 2*(n%2)); \\ Kevin Ryde, Oct 17 2020

Formula

a(n) = 0 iff n = A079523(k), a(n) = 1 iff n = A081706(2*k) or n = 1 + A081706(2*k), a(n) = 2 iff n = A036554(k).
a(2*n-1) + a(2*n) = 2.
a(2*n-1) = (A065037(2*n+1) - A065037(2*n-1) - 2)/2.
From Mikhail Kurkov, Oct 10 2020: (Start)
a(2^m-1) = 1 - m mod 2, m > 0,
a(2^m) = 1 + m mod 2, m > 0,
a(2^m+k) = a(k) for 0 < k < 2^m-1, m > 1.
a(2^m-k) = 2 - a(k-1) for 1 < k <= 2^(m-1), m > 1. (End)
a(2n+1) = mex{a(n)}, a(2n) = mex{a(n),a(2n+1)} or a(2n+1) = [a(n)=0], a(2n) = 2 - [a(n)=2] for n > 0 with a(1) = 0. - Mikhail Kurkov, Mar 25 2021

Extensions

More terms from Robert G. Wilson v, Mar 03 2005
Showing 1-2 of 2 results.