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

A039966 a(0) = 1; thereafter a(3n+2) = 0, a(3n) = a(3n+1) = a(n).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Dec 11 1999

Keywords

Comments

Number of partitions of n into distinct powers of 3.
Trajectory of 1 under the morphism: 1 -> 110, 0 -> 000. Thus 1 -> 110 ->110110000 -> 110110000110110000000000000 -> ... - Philippe Deléham, Jul 09 2005
Also, an example of a d-perfect sequence.
This is a composite of two earlier sequences contributed at different times by N. J. A. Sloane and by Reinhard Zumkeller, Mar 05 2005. Christian G. Bower extended them and found that they agreed for at least 512 terms. The proof that they were identical was found by Ralf Stephan, Jun 13 2005, based on the fact that they were both 3-regular sequences.

Examples

			The triples of elements (a(3k), a(3k+1), a(3k+2)) are (1,1,0) if a(k) = 1 and (0,0,0) if a(k) = 0.  So since a(2) = 0, a(6) = a(7) = a(8) = 0, and since a(3) = 1, a(9) = a(10) = 1 and a(11) = 0. - _Michael B. Porter_, Jul 11 2016
		

Crossrefs

For generating functions Product_{k>=0} (1+a*x^(b^k)) for the following values of (a,b) see: (1,2) A000012 and A000027, (1,3) A039966 and A005836, (1,4) A151666 and A000695, (1,5) A151667 and A033042, (2,2) A001316, (2,3) A151668, (2,4) A151669, (2,5) A151670, (3,2) A048883, (3,3) A117940, (3,4) A151665, (3,5) A151671, (4,2) A102376, (4,3) A151672, (4,4) A151673, (4,5) A151674.
Characteristic function of A005836 (and apart from offset of A003278).

Programs

  • Haskell
    a039966 n = fromEnum (n < 2 || m < 2 && a039966 n' == 1)
       where (n',m) = divMod n 3
    -- Reinhard Zumkeller, Sep 29 2011
    
  • Maple
    a := proc(n) option remember; if n <= 1 then RETURN(1) end if; if n = 2 then RETURN(0) end if; if n mod 3 = 2 then RETURN(0) end if; if n mod 3 = 0 then RETURN(a(1/3*n)) end if; if n mod 3 = 1 then RETURN(a(1/3*n - 1/3)) end if end proc; # Ralf Stephan, Jun 13 2005
  • Mathematica
    (* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) s = Rest[ Sort[ Plus @@@ Table[UnrankSubset[n, Table[3^i, {i, 0, 4}]], {n, 32}]]]; Table[ If[ Position[s, n] == {}, 0, 1], {n, 105}] (* Robert G. Wilson v, Jun 14 2005 *)
    CoefficientList[Series[Product[(1 + x^(3^k)), {k, 0, 5}], {x, 0, 111}], x] (* or *)
    Nest[ Flatten[ # /. {0 -> {0, 0, 0}, 1 -> {1, 1, 0}}] &, {1}, 5] (* Robert G. Wilson v, Mar 29 2006 *)
    Nest[ Join[#, #, 0 #] &, {1}, 5] (* Robert G. Wilson v, Jul 27 2014 *)
  • PARI
    {a(n)=local(A,m); if(n<0, 0, m=1; A=1+O(x); while(m<=n, m*=3; A=(1+x)*subst(A,x,x^3)); polcoeff(A,n))} /* Michael Somos, Jul 15 2005 */
    
  • PARI
    A039966(n)=vecmax(digits(n+!n,3))<2;
    apply(A039966, [0..99]) \\ M. F. Hasler, Feb 15 2023
    
  • Python
    def A039966(n):
        while n > 2:
            n,r = divmod(n,3)
            if r==2: return 0
        return int(n!=2) # M. F. Hasler, Feb 15 2023

Formula

a(0) = 1, a(1) = 0, a(n) = b(n-2), where b is the sequence defined by b(0) = 1, b(3n+2) = 0, b(3n) = b(3n+1) = b(n). - Ralf Stephan
a(n) = A005043(n-1) mod 3. - Christian G. Bower, Jun 12 2005
a(n) = A002426(n) mod 3. - John M. Campbell, Aug 24 2011
a(n) = A000275(n) mod 3. - John M. Campbell, Jul 08 2016
Properties: 0 <= a(n) <= 1, a(A074940(n)) = 0, a(A005836(n)) = 1; A104406(n) = Sum(a(k), 1 <= k <= n). - Reinhard Zumkeller, Mar 05 2005
Euler transform of sequence b(n) where b(3^k) = 1, b(2*3^k) = -1 and zero otherwise. - Michael Somos, Jul 15 2005
G.f. A(x) satisfies A(x) = (1+x)*A(x^3). - Michael Somos, Jul 15 2005
G.f.: Product{k>=0} 1+x^(3^k). Exponents give A005836.

Extensions

Entry revised Jun 30 2005
Offset corrected by John M. Campbell, Aug 24 2011

A102483 Numbers k such that 2^k contains no zeros in base 3.

Original entry on oeis.org

0, 1, 2, 3, 4, 15
Offset: 1

Views

Author

N. J. A. Sloane, Feb 25 2005

Keywords

Comments

I conjectured in 1973 that there are no further terms. This question is still open.
A104320(a(n)) = 0. - Reinhard Zumkeller, Mar 01 2005
No other terms less than 200000. - Robert G. Wilson v, Dec 06 2005
a(7) > 10^7. - Martin Ehrenstein, Jul 27 2021
If it exists, a(7) > 10^21. - Robert Saye, Mar 23 2022

Crossrefs

Programs

  • Mathematica
    Select[ Range@1000, FreeQ[ IntegerDigits[2^#, 3], 0] &] (* Robert G. Wilson v, Dec 06 2005 *)
  • PARI
    for (n=0, 100, if (vecmin(digits(2^n, 3)), print1(n, ", "))) \\ Michel Marcus, Mar 25 2015

A021823 Decimal expansion of 1/819.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Partial sums of A010892. - Paul Barry, Jun 06 2003
Expansion in any base b >= 3 of 1/((b-1)*(b^2-b+1)) = 1/(b^3-2b^2+2b-1). E.g., 1/14 in base 3, 1/39 in base 4, 1/84 in base 5, etc. - Franklin T. Adams-Watters, Nov 07 2006
a(n) is the second least significant digit in the ternary representation of 2^n (cf. A004642). - Alexandre Herrera, Oct 09 2023

Examples

			0.0012210012210012210...
		

Crossrefs

Cf. A004642, A153130 (2^n mod 9).

Programs

  • Mathematica
    Join[{0,0},RealDigits[1/819,10,120][[1]]] (* or *) PadRight[{},120,{0,0,1,2,2,1}] (* or *) LinearRecurrence[{2,-2,1},{0,0,1},120] (* Harvey P. Dale, Aug 19 2012 *)
  • PARI
    a(n)=1/819. \\ Charles R Greathouse IV, Sep 24 2015

Formula

a(n) = a(n-1)-a(n-2)+1 = 2-a(n-3) = a(n-6). - Henry Bottomley, Apr 12 2000
a(n) = Sum_{k=1..floor(n/2)} (-1)^(k+1)*binomial(n-k, k) = 1-((-1)^floor(n/3)+(-1)^(floor((n+1)/3)))/2. - Vladeta Jovovic, Feb 10 2003
G.f.: x^2/(1-2x+2x^2-x^3)=x^2/((1-x)(x^2-x+1)). - Paul Barry, Jun 06 2003
a(n+2) = sum{k=0..n, binomial(n-2k, n-k)}. - Paul Barry, Jan 15 2005
a(0)=0, a(1)=0, a(2)=1, a(n)=2*a(n-1)-2*a(n-2)+a(n-3). - Harvey P. Dale, Aug 19 2012

A104320 Number of zeros in ternary representation of 2^n.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 1, 1, 1, 4, 1, 0, 4, 2, 3, 3, 3, 3, 3, 7, 7, 9, 5, 6, 6, 4, 4, 3, 5, 6, 7, 9, 9, 10, 6, 6, 9, 9, 8, 9, 8, 7, 13, 12, 13, 9, 5, 9, 8, 6, 16, 13, 9, 10, 11, 11, 7, 14, 13, 13, 9, 12, 14, 15, 15, 11, 11, 17, 15, 19, 14, 19, 12, 18, 15, 11, 10, 16, 15, 14, 14, 13, 17, 14
Offset: 0

Views

Author

Reinhard Zumkeller, Mar 01 2005

Keywords

Comments

Conjecture from N. J. A. Sloane: a(n) > 0 for n > 15, see A102483.

Examples

			n=13: 2^13=8192 -> '102020102', a(13) = 4.
		

Crossrefs

Programs

  • Magma
    [Multiplicity(Intseq(2^n,3),0):n in [0..90]]; // Marius A. Burtea, Nov 17 2019
  • Maple
    f:= n -> numboccur(0, convert(2^n,base,3)):
    map(f, [$0..100]); # Robert Israel, Nov 17 2019
  • Mathematica
    Table[DigitCount[2^n,3,0],{n,0,90}] (* Harvey P. Dale, May 06 2014 *)
  • PARI
    a(n) = my(d=vecsort(digits(2^n, 3))); #setintersect(d, vector(#d)) \\ Felix Fröhlich, Nov 17 2019
    
  • PARI
    a(n) = #select(d->!d, digits(2^n, 3)); \\ Ruud H.G. van Tol, May 09 2024
    

Formula

a(n) = A077267(A000079(n)).
a(A104321(n))=n and a(m)<>n for m < A104321(n).

A000866 2^n written in base 5.

Original entry on oeis.org

1, 2, 4, 13, 31, 112, 224, 1003, 2011, 4022, 13044, 31143, 112341, 230232, 1011014, 2022033, 4044121, 13143242, 31342034, 113234123, 232023301, 1014102102, 2033204204, 4121413413, 13243332331, 32042220212, 114134440424, 233324431403, 1022204413311
Offset: 0

Views

Author

N. J. A. Sloane, Jacques Haubrich (jhaubrich(AT)freeler.nl)

Keywords

Crossrefs

Cf. A000079, A004642, ..., A004655: powers of 2 written in base 10, 3, 4, ..., 16
Cf. A000244, A004656, A004658, A004659, ... : powers of 3 written in base 10, 2, 4, 5, ...

Programs

  • Mathematica
    Table[FromDigits[IntegerDigits[2^n, 5]], {n, 0, 30}] (* T. D. Noe, Jun 20 2012 *)
  • PARI
    a(n)=fromdigits(digits(2^n,5)) \\ M. F. Hasler, Jun 23 2018

Extensions

More terms from Erich Friedman.

A037096 Periodic vertical binary vectors computed for powers of 3: a(n) = Sum_{k=0 .. (2^n)-1} (floor((3^k)/(2^n)) mod 2) * 2^k.

Original entry on oeis.org

1, 2, 0, 204, 30840, 3743473440, 400814250895866480, 192435610587299441243182587501623263200, 2911899996313975217187797869354128351340558818020188112521784134070351919360
Offset: 0

Views

Author

Antti Karttunen, Jan 29 1999

Keywords

Comments

This sequence can be also computed with a recurrence that does not explicitly refer to 3^n. See the C program.
Conjecture: For n >= 3, each term a(n), when considered as a GF(2)[X] polynomial, is divisible by the GF(2)[X] polynomial (x + 1) ^ A055010(n-1). If this holds, then for n >= 3, a(n) = A048720(A136386(n), A048723(3,A055010(n-1))).

Examples

			When powers of 3 are written in binary (see A004656), under each other as:
  000000000001 (1)
  000000000011 (3)
  000000001001 (9)
  000000011011 (27)
  000001010001 (81)
  000011110011 (243)
  001011011001 (729)
  100010001011 (2187)
it can be seen that the bits in the n-th column from the right can be arranged in periods of 2^n: 1, 2, 4, 8, ... This sequence is formed from those bits: 1, is binary for 1, thus a(0) = 1. 01, reversed is 10, which is binary for 2, thus a(1) = 2, 0000 is binary for 0, thus a(2)=0, 000110011, reversed is 11001100 = A007088(204), thus a(3) = 204.
		

References

  • S. Wolfram, A New Kind of Science, Wolfram Media Inc., (2002), p. 119.

Crossrefs

Cf. A036284, A037095, A037097, A136386 for related sequences.
Cf. also A004642, A265209, A265210 (for 2^n written in base 3).

Programs

  • Maple
    a(n) := sum( 'bit_n(3^i, n)*(2^i)', 'i'=0..(2^(n))-1);
    bit_n := (x, n) -> `mod`(floor(x/(2^n)), 2);

Formula

a(n) = Sum_{k=0 .. A000225(n)} (floor(A000244(k)/(2^n)) mod 2) * 2^k.
Other identities and observations:
For n >= 2, a(n) = A000215(n-1)*A037097(n) = A048720(A037097(n), A048723(3, A000079(n-1))).

Extensions

Entry revised by Antti Karttunen, Dec 29 2007
Name changed and the example corrected by Antti Karttunen, Dec 05 2015

A368866 The smallest positive number such that 2^a(n) when written in base n contains adjacent equal digits.

Original entry on oeis.org

2, 2, 4, 5, 6, 3, 6, 12, 16, 14, 11, 15, 8, 4, 8, 23, 16, 14, 16, 21, 9, 17, 20, 14, 30, 27, 16, 15, 10, 5, 10, 29, 48, 14, 46, 19, 18, 15, 32, 36, 27, 36, 18, 12, 56, 41, 37, 24, 58, 22, 26, 46, 58, 40, 29, 24, 36, 14, 20, 18, 12, 6, 12, 60, 62, 50, 49, 50, 20, 35, 36, 55, 61, 52, 53, 77
Offset: 2

Views

Author

Scott R. Shannon, Jan 08 2024

Keywords

Comments

In the first 10000 terms the largest value is a(9031) = 1924, with a corresponding power of 2 of approximately 1.52*10^579.

Examples

			a(2) = 2 as 2^2 = 4 written in base 2 = 100_2 which contains adjacent 0's.
a(6) = 6 as 2^6 = 64 written in base 6 = 144_6 which contains adjacent 4's.
a(10) = 16 as 2^16 = 65536 written in base 10 = 65536_10 which contains adjacent 5's.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k,L;
      for k from 1 do
        L:= convert(2^k,base,n);
        if member(0, L[2..-1]-L[1..-2]) then return k fi
      od
    end proc:
    map(f, [$2..100]); # Robert Israel, Jan 09 2024
  • Python
    from itertools import count
    from sympy.ntheory.factor_ import digits
    def A368866(n):
        k = 1
        for m in count(1):
            k <<= 1
            s = digits(k,n)[1:]
            if any(s[i]==s[i+1] for i in range(len(s)-1)):
                return m # Chai Wah Wu, Jan 08 2024

A004663 Powers of 3 written in base 9.

Original entry on oeis.org

1, 3, 10, 30, 100, 300, 1000, 3000, 10000, 30000, 100000, 300000, 1000000, 3000000, 10000000, 30000000, 100000000, 300000000, 1000000000, 3000000000, 10000000000, 30000000000, 100000000000, 300000000000, 1000000000000, 3000000000000, 10000000000000, 30000000000000
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A000244, A004656, A004658, A004659, ... : powers of 3 in base 10, 2, 4, 5, ...
Cf. A000079, A004642, ..., A004655: powers of 2 written in base 10, 2, 3, ..., 16.

Programs

  • Maple
    seq(op([10^i,3*10^i]),i=0..100); # Robert Israel, Jun 25 2018
  • Mathematica
    Table[FromDigits[IntegerDigits[3^n, 9]], {n, 0, 100}] (* G. C. Greubel, Oct 12 2018 *)
  • PARI
    a(n)=3^bittest(n,0)*10^(n\2) \\ M. F. Hasler, Jun 25 2018

Formula

From Paul Barry, Jul 14 2004: (Start)
G.f.: (1 + 3*x)/(1 - 10*x^2);
a(n) = 2*a(n-1) + 3*a(n-2) + 10^floor((n-2)/2);
a(n) = Sum_{k=0..floor(n/2)} binomial(floor(n/2), k)*3^(n-2*k). (End)
a(n) = 3*a(n-1) + ((1 + (-1)^n)/2)*a(n-2) with a(0)=1, a(1)=3. - Taras Goy, Mar 20 2019
E.g.f.: cosh(sqrt(10)*x) + 3*sinh(sqrt(10)*x)/sqrt(10). - Stefano Spezia, Mar 31 2023

A259667 Catalan numbers mod 6.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Nov 08 2015

Keywords

Comments

The only odd terms are those with indices n = 2^k - 1 (k = 0, 1, 2, 3, ...); see also A038003.
It is conjectured that the only k which yield a(2^k-1) = 1 are k = 0, 1 and 5. Are there other k than 2 and 8 that yield a(2^k-1) = 5? Otherwise said, is a(2^k-1) = 3 for all k > 8?
The question is equivalent to: does 2^k - 1 always contain a digit 2 when converted into base 3 for all k > 8? Similar conjecture has been proposed for 2^k, see A004642. - Jianing Song, Sep 04 2018

Crossrefs

Programs

  • Mathematica
    Mod[CatalanNumber[Range[0,120]],6] (* Harvey P. Dale, Oct 24 2020 *)
  • PARI
    a(n)=binomial(2*n,n)/(n+1)%6
    
  • PARI
    A259667(n)=lift(if(n%3!=1,binomod(2*n+1,n,6)/(2*n+1), if(bittest(n,0),binomod(2*n,n-1,6)/n,binomod(2*n,n,6)/(n+1)))) \\ using binomod.gp by M. Alekseyev, cf. Links.

Formula

a(n) = A000108(n) mod 6.

A104406 Number of numbers <= n having no 2 in ternary representation.

Original entry on oeis.org

1, 1, 2, 3, 3, 3, 3, 3, 4, 5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 9, 10, 11, 11, 11, 11, 11, 12, 13, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 05 2005

Keywords

Comments

Partial sums of A039966: a(n) = Sum(A039966(k): 1<=k<=n).

Crossrefs

This is a lower bound for A003002.
Showing 1-10 of 22 results. Next