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.

A105672 a(1)=1, then bracketing n with powers of 3 as f(t)=3^t for f(t) < n <= f(t+1), a(n) = f(t+1) - a(n-f(t)).

Original entry on oeis.org

1, 2, 1, 8, 7, 8, 1, 2, 1, 26, 25, 26, 19, 20, 19, 26, 25, 26, 1, 2, 1, 8, 7, 8, 1, 2, 1, 80, 79, 80, 73, 74, 73, 80, 79, 80, 55, 56, 55, 62, 61, 62, 55, 56, 55, 80, 79, 80, 73, 74, 73, 80, 79, 80, 1, 2, 1, 8, 7, 8, 1, 2, 1, 26, 25, 26, 19, 20, 19, 26, 25, 26, 1, 2, 1, 8, 7, 8, 1, 2, 1
Offset: 1

Views

Author

Benoit Cloitre, May 03 2005

Keywords

Crossrefs

Programs

  • Maple
    A105672 := proc(n)
            option remember;
            if n = 1 then
                    1;
            else
                    fn1 := A064235(n) ;
                    fn := fn1/3 ;
                    fn1-procname(n-fn) ;
            end if;
    end proc:
    seq(A105672(n),n=1..80) ; # R. J. Mathar, Nov 06 2011
  • Mathematica
    A064235[n_] := 3^Ceiling[Log[3, n]]; a[1] = 1; a[n_] := a[n] = A064235[n] - a[n - A064235[n]/3]; Table[a[n], {n, 1, 81}] (* Jean-François Alcover, Jul 09 2013, after R. J. Mathar *)
  • 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(n+1) = 1 + Sum_{k=1..n} (-1)^k*(2-3*3^valuation(k, 3)).
a(n) = A064235(n) - a(n - A064235(n)/3). - R. J. Mathar, Nov 06 2011