login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A039966 a(0) = 1; thereafter a(3n+2) = 0, a(3n) = a(3n+1) = a(n). 32
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
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.
LINKS
David Applegate, Omar E. Pol and N. J. A. Sloane, The Toothpick Sequence and Other Sequences from Cellular Automata, Congressus Numerantium, Vol. 206 (2010), 157-191. [There is a typo in Theorem 6: (13) should read u(n) = 4.3^(wt(n-1)-1) for n >= 2.]
D. Kohel, S. Ling and C. Xing, Explicit Sequence Expansions, in Sequences and their Applications, C. Ding, T. Helleseth, and H. Niederreiter, eds., Proceedings of SETA'98 (Singapore, 1998), 308-317, 1999.
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.
EXAMPLE
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
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 *)
PROG
(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
(Haskell)
a039966 n = fromEnum (n < 2 || m < 2 && a039966 n' == 1)
where (n', m) = divMod n 3
-- Reinhard Zumkeller, Sep 29 2011
(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
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).
Sequence in context: A077050 A128432 A195198 * A089451 A145099 A205083
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Dec 11 1999
EXTENSIONS
Entry revised Jun 30 2005
Offset corrected by John M. Campbell, Aug 24 2011
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 19 01:22 EDT 2024. Contains 370952 sequences. (Running on oeis4.)