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.

Previous Showing 21-30 of 43 results. Next

A023717 Numbers with no 3's in base-4 expansion.

Original entry on oeis.org

0, 1, 2, 4, 5, 6, 8, 9, 10, 16, 17, 18, 20, 21, 22, 24, 25, 26, 32, 33, 34, 36, 37, 38, 40, 41, 42, 64, 65, 66, 68, 69, 70, 72, 73, 74, 80, 81, 82, 84, 85, 86, 88, 89, 90, 96, 97, 98, 100, 101, 102, 104, 105, 106, 128, 129, 130, 132, 133, 134, 136, 137, 138
Offset: 0

Views

Author

Keywords

Comments

A032925 is the intersection of this sequence and A023705; cf. A179888. - Reinhard Zumkeller, Jul 31 2010
Fixed point of the morphism: 0-> 0,1,2; 1-> 4,5,6; 2-> 8,9,10; ...; n-> 4n,4n+1,4n+2. - Philippe Deléham, Oct 22 2011

Crossrefs

Programs

  • C
    uint32_t a_next(uint32_t a_n) {
        uint32_t t = ((a_n ^ 0xaaaaaaaa) | 0x55555555) >> 1;
        return (a_n - t) & t;
    } // Falk Hüffner, Jan 22 2022
    
  • Haskell
    a023717 n = a023717_list !! (n-1)
    a023717_list = filter f [0..] where
       f x = x < 3 || (q < 3 && f x') where (x', q) = divMod x 4
    -- Reinhard Zumkeller, Apr 18 2015
    
  • Julia
    function a(n)
        m, r, b = n, 0, 1
        while m > 0
            m, q = divrem(m, 3)
            r += b * q
            b *= 4
        end
    r end; [a(n) for n in 0:58] |> println # Peter Luschny, Jan 03 2021
    
  • Mathematica
    Select[ Range[ 0, 140 ], (Count[ IntegerDigits[ #, 4 ], 3 ]==0)& ]
  • PARI
    a(n)=if(n<1,0,if(n%3,a(n-1)+1,4*a(n/3)))
    
  • PARI
    a(n)=if(n<1,0,4*a(floor(n/3))+n-3*floor(n/3))
    
  • Python
    from gmpy2 import digits
    def A023717(n): return int(digits(n,3),4) # Chai Wah Wu, May 06 2025

Formula

a(n) = Sum_{i=0..m} d(i)*4^i, where Sum_{i=0..m} d(i)*3^i is the base-3 representation of n. - Clark Kimberling
a(3n) = 4*a(n); a(3n+1) = 4*a(n)+1; a(3n+2) = 4*a(n)+2; a(n) = 4*a(floor(n/3)) + n - 3*floor(n/3). - Benoit Cloitre, Apr 27 2003
a(n) = Sum_{k>=0} A030341(n,k)*4^k. - Philippe Deléham, Oct 22 2011

A031087 Triangle T(n,k): write n in base 9, reverse order of digits.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A030308, A030341, A030386, A031235, A030567, A031007, A031045, A031298 for the base-2 to base-10 analogs.

Programs

  • Haskell
    a031087 n k = a031087_row n !! (k-1)
    a031087_row n | n < 9     = [n]
                  | otherwise = m : a031087_row n' where (n',m) = divMod n 9
    a031087_tabf = map a031087_row [0..]
    -- Reinhard Zumkeller, Jul 07 2015
  • PARI
    A031087(n, k=-1)=/*k<0&&error("Flattened sequence not yet implemented.")*/n\9^k%9 \\ Assuming that columns are numbered starting with k=0 as in A030308, A030567 and others. - M. F. Hasler, Jul 21 2013
    

Extensions

Initial 0 and better name by Philippe Deléham, Oct 20 2011

A054635 Champernowne sequence: write n in base 3 and juxtapose.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Apr 16 2000

Keywords

Comments

Essentially the same as A003137. - R. J. Mathar, Aug 29 2009
An irregular table in which the n-th row lists the base-3 digits of n. - Jason Kimberley, Dec 07 2012
The base-3 Champernowne constant (A077771): it is normal in base 3. - Jason Kimberley, Dec 07 2012

Crossrefs

Cf. A054637 (partial sums).
Cf. A081604 (row lengths), A053735 (row sums), A030341 (rows reversed), A007089, A077771.
Table in which the n-th row lists the base b digits of n: A030190 and A030302 (b=2), A003137 and this sequence (b=3), A030373 (b=4), A031219 (b=5), A030548 (b=6), A030998 (b=7), A031035 and A054634 (b=8), A031076 (b=9), A007376 and A033307 (b=10). - Jason Kimberley, Dec 06 2012

Programs

  • Haskell
    a054635 n k = a054635_tabf !! n !! k
    a054635_row n = a054635_tabf !! n
    a054635_tabf = map reverse a030341_tabf
    a054635_list = concat a054635_tabf
    -- Reinhard Zumkeller, Feb 21 2013
    
  • Magma
    [0]cat &cat[Reverse(IntegerToSequence(n,3)):n in[1..31]]; // Jason Kimberley, Dec 07 2012
    
  • Mathematica
    almostNatural[n_, b_] := Block[{m = 0, d = n, i = 1, l, p}, While[m <= d, l = m; m = (b - 1) i*b^(i - 1) + l; i++]; i--; p = Mod[d - l, i]; q = Floor[(d - l)/i] + b^(i - 1); If[p != 0, IntegerDigits[q, b][[p]], Mod[q - 1, b]]]; Array[ almostNatural[#, 3] &, 105, 0] (* Robert G. Wilson v, Jun 29 2014 *)
    First[RealDigits[ChampernowneNumber[3], 3, 100, 0]] (* Paolo Xausa, Jun 19 2024 *)
  • Python
    from sympy.ntheory.digits import digits
    def agen(limit):
        for n in range(limit):
            yield from digits(n, 3)[1:]
    print([an for an in agen(35)]) # Michael S. Branicky, Sep 01 2021

A031045 Triangle T(n,k): write n in base 8, reverse order of digits.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A030308, A030341, A030386, A031235, A030567, A031007, A031087, A031298 for the base-2 to base-10 analogs.

Programs

  • Maple
    seq(op(convert(n,base,8)),n=0..100); # Robert Israel, Jul 22 2019
  • Mathematica
    Flatten[Table[Reverse[IntegerDigits[n,8]],{n,80}]] (* Harvey P. Dale, Aug 08 2011 *)
  • PARI
    A031045(n, k=-1)=/*k<0&&error("Flattened sequence not yet implemented.");*/n\8^k%8 \\ Assuming that columns are numbered starting with k=0 as in A030308, A030341, ... Note: The operation could be done using bitwise arithmetic, bitand(n>>(3*k),7), but this is not significantly faster in PARI. - M. F. Hasler, Jul 21 2013

Extensions

Initial 0 and better name by Philippe Deléham, Oct 20 2011

A065361 Rebase n from 3 to 2. Replace 3^k with 2^k in ternary expansion of n.

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 4, 5, 6, 4, 5, 6, 6, 7, 8, 8, 9, 10, 8, 9, 10, 10, 11, 12, 12, 13, 14, 8, 9, 10, 10, 11, 12, 12, 13, 14, 12, 13, 14, 14, 15, 16, 16, 17, 18, 16, 17, 18, 18, 19, 20, 20, 21, 22, 16, 17, 18, 18, 19, 20, 20, 21, 22, 20, 21, 22, 22, 23, 24, 24, 25, 26, 24, 25, 26, 26, 27
Offset: 0

Views

Author

Marc LeBrun, Oct 31 2001

Keywords

Comments

Notation: (3)[n](2).
Fixed point of the morphism 0->0,1,2; 1->2,3,4; 2->4,5,6; ...; n->2n,2n+1,2n+2. - Philippe Deléham, Oct 22 2011

Examples

			15 = 120 -> 1(4)+2(2)+0(1) = 8 = a(15).
		

Crossrefs

Programs

  • Julia
    function a(n)
        m, r, b = n, 0, 1
        while m > 0
            m, q = divrem(m, 3)
            r += b * q
            b *= 2
        end
    r end; [a(n) for n in 0:76] |> println # Peter Luschny, Jan 03 2021
  • Mathematica
    t = Table[FromDigits[RealDigits[n, 3], 2], {n, 0, 100}]
    (* Clark Kimberling, Aug 02 2012 *)
  • PARI
    a(n)=if(n<1,0,if(n%3,a(n-1)+1,2*a(n/3)))
    
  • PARI
    a(n)=if(n<1,0,2*a(floor(n/3))+n-3*floor(n/3))
    
  • PARI
    Rebase(x, b, c)= { local(d, e=0, f=1); while (x>0, d=x-b*(x\b); x\=b; e+=d*f; f*=c); return(e) } { for (n=0, 1000, write("b065361.txt", n, " ", Rebase(n, 3, 2)) ) } \\ Harry J. Smith, Oct 17 2009
    

Formula

a(0)=0, a(3n)=2*a(n), a(3n+1)=2*a(n)+1, a(3n+2)=2*a(n)+2. - Benoit Cloitre, Dec 21 2002
a(n) = 2*a(floor(n/3))+n-3*floor(n/3). - Benoit Cloitre, Apr 27 2003
a(n) = Sum_{k>=0} A030341(n,k)*2^k. - Philippe Deléham, Oct 22 2011

A031007 Triangle T(n,k): Write n in base 7, reverse order of digits, to get row n.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A030308, A030341, A030386, A031235, A030567, A031045, A031087, A031298 for the base-2 to base-10 analogs.

Programs

  • Mathematica
    Flatten[Table[Reverse[IntegerDigits[n,7]],{n,0,50}]] (* Harvey P. Dale, Feb 25 2014 *)
  • PARI
    A031007(n, k=-1)={k<0&&error("Flattened sequence not yet implemented.");n\7^k%7} \\ Assuming that columns start with k=0 as in A030308, A030341, ... TO DO: implement flattened sequence, such that A030567(n)=a(n). - M. F. Hasler, Jul 21 2013

Extensions

Initial 0 and better name by Philippe Deléham, Oct 20 2011

A047240 Numbers that are congruent to {0, 1, 2} mod 6.

Original entry on oeis.org

0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, 24, 25, 26, 30, 31, 32, 36, 37, 38, 42, 43, 44, 48, 49, 50, 54, 55, 56, 60, 61, 62, 66, 67, 68, 72, 73, 74, 78, 79, 80, 84, 85, 86, 90, 91, 92, 96, 97, 98, 102, 103, 104, 108, 109, 110, 114, 115, 116, 120, 121, 122
Offset: 1

Views

Author

Keywords

Comments

Partial sums of 0,1,1,4,1,1,4,... - Paul Barry, Feb 19 2007
Numbers k such that floor(k/3) = 2*floor(k/6). - Bruno Berselli, Oct 05 2017

Crossrefs

Cf. similar sequences with formula n+i*floor(n/3) listed in A281899.

Programs

Formula

From Paul Barry, Feb 19 2007: (Start)
G.f.: x*(1 + x + 4*x^2)/((1 - x)*(1 - x^3)).
a(n) = 2*n - 3 - cos(2*n*Pi/3) + sin(2*n*Pi/3)/sqrt(3). (End)
a(n) = n-1 + 3*floor((n-1)/3). - Philippe Deléham, Apr 21 2009
a(n) = 6*floor(n/3) + (n mod 3). - Gary Detlefs, Mar 09 2010
a(n+1) = Sum_{k>=0} A030341(n,k)*b(k) with b(0)=1 and b(k)=2*3^k for k>0. - Philippe Deléham, Oct 22 2011.
a(n) = 2*n - 2 - A010872(n-1). - Wesley Ivan Hurt, Jul 07 2013
From Wesley Ivan Hurt, Jun 14 2016: (Start)
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(3*k) = 6*k-4, a(3*k-1) = 6*k-5, a(3*k-2) = 6*k-6. (End)
Sum_{n>=2} (-1)^n/a(n) = (3-sqrt(3))*Pi/18 + log(2+sqrt(3))/(2*sqrt(3)). - Amiram Eldar, Dec 14 2021
E.g.f.: 4 + exp(x)*(2*x - 3) - exp(-x/2)*(3*cos(sqrt(3)*x/2) - sqrt(3)*sin(sqrt(3)*x/2))/3. - Stefano Spezia, Jul 26 2024

Extensions

Paul Barry formula adapted for offset 1 by Wesley Ivan Hurt, Jun 14 2016

A065368 Alternating sum of ternary digits in n. Replace 3^k with (-1)^k in ternary expansion of n.

Original entry on oeis.org

0, 1, 2, -1, 0, 1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, 2, 3, 4, 1, 2, 3, 0, 1, 2, -1, 0, 1, -2, -1, 0, -3, -2, -1, 0, 1, 2, -1, 0, 1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, -2, -1, 0, -3, -2, -1, -4, -3, -2, -1, 0, 1, -2, -1, 0, -3, -2, -1, 0, 1, 2, -1, 0, 1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, 2, 3, 4, 1, 2, 3, 0, 1, 2, 3, 4, 5, 2, 3
Offset: 0

Views

Author

Marc LeBrun, Oct 31 2001

Keywords

Comments

Notation: (3)[n](-1).
Fixed point of the morphism 0 -> 0,1,2; 1 -> -1,0,1; 2 -> -2,-1,0; ...; n -> -n,-n+1,-n+2. - Philippe Deléham, Oct 22 2011

Examples

			15 = +1(9)+2(3)+0(1) -> +1(+1)+2(-1)+0(+1) = -1 = a(15).
		

Crossrefs

Programs

  • Python
    from sympy.ntheory.digits import digits
    def a(n):
        return sum(bi*(-1)**k for k, bi in enumerate(digits(n, 3)[1:][::-1]))
    print([a(n) for n in range(104)]) # Michael S. Branicky, Jul 28 2021
    
  • Python
    from sympy.ntheory import digits
    def A065368(n): return sum((0, 1, 2, -1, 0, 1, -2, -1, 0)[i] for i in digits(n,9)[1:]) # Chai Wah Wu, Jul 19 2024

Formula

a(n) = Sum_{k>=0} A030341(n,k)*(-1)^k. - Philippe Deléham, Oct 22 2011.
G.f. A(x) satisfies: A(x) = x * (1 + 2*x) / (1 - x^3) - (1 + x + x^2) * A(x^3). - Ilya Gutkovskiy, Jul 28 2021

Extensions

Initial 0 added by Philippe Deléham, Oct 22 2011

A065369 Replace 3^k with (-3)^k in ternary expansion of n.

Original entry on oeis.org

0, 1, 2, -3, -2, -1, -6, -5, -4, 9, 10, 11, 6, 7, 8, 3, 4, 5, 18, 19, 20, 15, 16, 17, 12, 13, 14, -27, -26, -25, -30, -29, -28, -33, -32, -31, -18, -17, -16, -21, -20, -19, -24, -23, -22, -9, -8, -7, -12, -11, -10, -15, -14, -13, -54, -53, -52, -57, -56, -55, -60, -59, -58, -45, -44, -43, -48, -47, -46
Offset: 0

Views

Author

Marc LeBrun, Oct 31 2001

Keywords

Comments

Base 3 representation for n (in lexicographic order) converted from base -3 to base 10.
Notation: (3)[n](-3)
Fixed point of the morphism 0-> 0,1,2 ; 1-> -3,-2,-1 ; 2-> -6,-5,-4 ; ...; n-> -3n,-3n+1,-3n+2. - Philippe Deléham, Oct 22 2011

Examples

			15 = +1(9)+2(3)+0(1) -> +1(+9)+2(-3)+0(+1) = +3 = a(15)
		

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 3]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 3]], {n, 1, 80}]; b
  • PARI
    a(n) = fromdigits(digits(n, 3), -3) \\ Rémy Sigrist, Feb 06 2020

Formula

a(n) = Sum_{k>=0} A030341(n,k)*(-3)^k. - Philippe Deléham, Oct 22 2011
a(3*k+m) = -3*a(k)+m for 0 <= m < 3. - Chai Wah Wu, Jan 16 2020

A060236 If n mod 3 = 0 then a(n) = a(n/3), otherwise a(n) = n mod 3.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 21 2001

Keywords

Comments

A cubefree word. Start with 1, apply the morphisms 1 -> 121, 2 -> 122, take limit. See A080846 for another version.
Ultimate modulo 3: n-th digit of terms in "Ana sequence" (see A060032 for definition).
Equals A005148(n) reduced mod 3. In "On a sequence Arising in Series for Pi" Morris Newman and Daniel Shanks conjectured that 3 never divides A005148(n) and D. Zagier proved it. - Benoit Cloitre, Jun 22 2002
Also equals A038502(n) mod 3.
Last nonzero digit in ternary representation of n. - Franklin T. Adams-Watters, Apr 01 2006
a(2*n) = length of n-th run of twos. - Reinhard Zumkeller, Mar 13 2015

Examples

			a(10)=1 since 10=3^0*10 and 10 mod 3=1;
a(72)=2 since 24=3^3*8 and 8 mod 3=2.
		

Crossrefs

Cf. A026225 (indices of 1's), A026179 (indices of 2's).
Cf. A060032 (concatenate 3^n terms).

Programs

  • Haskell
    following Franklin T. Adams-Watters's comment.
    a060236 = head . dropWhile (== 0) . a030341_row
    -- Reinhard Zumkeller, Mar 13 2015
    
  • Magma
    [(Floor(n/3^Valuation(n, 3)) mod 3): n in [1..120]]; // G. C. Greubel, Nov 05 2024
    
  • Mathematica
    Nest[ Flatten[ # /. {1 -> {1, 2, 1}, 2 -> {1, 2, 2}}] &, {1}, 5] (* Robert G. Wilson v, Mar 04 2005 *)
    Table[Mod[n/3^IntegerExponent[n, 3], 3], {n, 1, 120}] (* Clark Kimberling, Oct 19 2016 *)
    lnzd[m_]:=Module[{s=Split[m]},If[FreeQ[Last[s],0],s[[-1,1]],s[[-2,1]]]]; lnzd/@Table[IntegerDigits[n,3],{n,120}] (* Harvey P. Dale, Oct 19 2018 *)
  • PARI
    a(n)=if(n<1, 0, n/3^valuation(n,3)%3) /* Michael Somos, Nov 10 2005 */
    
  • SageMath
    [n/3^valuation(n, 3)%3 for n in range(1,121)] # G. C. Greubel, Nov 05 2024

Formula

a(3*n) = a(n), a(3*n + 1) = 1, a(3*n + 2) = 2. - Michael Somos, Jul 29 2009
a(n) = 1 + A080846(n). - Joerg Arndt, Jan 21 2013
Previous Showing 21-30 of 43 results. Next