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.

A105670 a(1)=1 then bracketing n by powers of 2 as f(t)=2^t for f(t) < n <= f(t+1), a(n) = f(t+1) - a(n-f(t)).

Original entry on oeis.org

1, 1, 3, 3, 7, 7, 5, 5, 15, 15, 13, 13, 9, 9, 11, 11, 31, 31, 29, 29, 25, 25, 27, 27, 17, 17, 19, 19, 23, 23, 21, 21, 63, 63, 61, 61, 57, 57, 59, 59, 49, 49, 51, 51, 55, 55, 53, 53, 33, 33, 35, 35, 39, 39, 37, 37, 47, 47, 45, 45, 41, 41, 43, 43, 127, 127, 125, 125, 121, 121, 123
Offset: 1

Views

Author

Benoit Cloitre, May 03 2005

Keywords

Crossrefs

Programs

  • Maple
    A062383 := proc(n)
            ceil(log(n)/log(2)) ;
            2^% ;
    end proc:
    A105670 := proc(n)
            option remember;
            if n = 1 then
                    1;
            else
                    fn1 := A062383(n) ;
                    fn := fn1/2 ;
                    fn1-procname(n-fn) ;
            end if;
    end proc:
    seq(A105670(n),n=1..80) ; # R. J. Mathar, Nov 06 2011
  • Mathematica
    t[0] = 0; t[1] = 1; t[n_?EvenQ] := t[n] = t[n/2]; t[n_?OddQ] := t[n] = 1 - t[(n-1)/2]; a[1] = 1; a[n_?EvenQ] := a[n] = a[n - 1]; a[n_] := a[n] = 2*a[Ceiling[n/2]] - 1 + 2*t[Ceiling[n/2] - 1]; Table[a[n], {n, 1, 71}] (* Jean-François Alcover, Aug 13 2013 *)
  • PARI
    b(n,m)=if(n<2,1,m*m^floor(log(n-1)/log(m))-b(n-m^floor(log(n-1)/log(m)),m))

Formula

a(2n-1) = a(2n).
a(n) = 2*a(ceiling(n/2)) -1 + 2*t(ceiling(n/2)-1) where t(n) = A010060(n) is the Thue-Morse sequence.
a(2n-1) = a(2n) = 2*A006068(n-1)+1. - Jeffrey Shallit, Mar 15 2025

Extensions

Typo in data corrected by Jean-François Alcover, Aug 13 2013