OFFSET
0,1
COMMENTS
Also Apery numbers (mod 3).
More generally also (Sum_{k=0..n} binomial(n,k)^x*binomial(n+k,k)^y) (mod 3) for any x >= 1 in N and any odd y >= 1.
a(n) = 0 if the ternary expansion of n contains one or more 1-digits, otherwise 1. - Antti Karttunen, Aug 23 2019
Main diagonal of the Sierpinski carpet (A153490). - Paolo Xausa, May 19 2023
We can consider each occurrence of a(n) = 1 to represent an image of the Cantor middle thirds set spanning [n, n+1], with a(m) = 0 indicating that [m, m+1] is empty. Then for k >= 0, the finite sequence a(0) .. a(3^k-1) represents a scaled image of the middle thirds set spanning [0, 3^k], illustrating a symmetry of scale with respect to the endpoint of the set. For scale symmetry around the set's quarter points see A355681 and A355682. - Peter Munn, Sep 19 2025
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..59048
Michael Coons and James Evans, A sequential view of self-similar measures, or, What the ghosts of Mahler and Cantor can teach us about dimension, arXiv:2011.10722 [math.NT], 2020. See Figure 2, p. 2.
Steven Robertson and Noy Soffer Aranov, Fractals Emerging from the Toepltiz Determinants of the p-Cantor Sequence, arXiv:2510.19449 [math.NT], 2025. See p. 6.
Eric Weisstein's World of Mathematics, Cantor Fractal.
FORMULA
G.f.: Product_{k>=0} (1 + x^(2*3^k)). - Ilya Gutkovskiy, Jun 05 2021
MATHEMATICA
Nest[ Flatten[# /. {0 -> {0, 0, 0}, 1 -> {1, 0, 1}}] &, {1}, 5] (* Or *)
f[n_] := Mod[LegendreP[n, 3], 3]; Array[f, 111, 0] (* Or *)
f[n_] := If[ FreeQ[ IntegerDigits[n, 3], 1], 1, 0]; Array[f, 111, 0] (* also from Mathematica v8.0 Mathematical Functions Help section for "IntegerDigits" "Cantor set construction:" *) (* Robert G. Wilson v, Jun 16 2011 *)
Nest[Join[#, 0 #, #] &, {1}, 5] (* IWABUCHI Yu(u)ki, Sep 08 2012 *)
PROG
(PARI) a(n)=sum(k=0, n, binomial(n, k)*binomial(n+k, k))%3
(PARI) A088917(n) = { while(n, if(n%3==1, return(0), n\=3)); (1); }; \\ Antti Karttunen, Aug 23 2019 (copied from A005823)
(PARI) A088917(n) = abs(factorback(apply(d -> d-1, digits(n, 3)))); \\ Antti Karttunen, Aug 23 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Benoit Cloitre, Nov 30 2003
EXTENSIONS
Secondary name added by Antti Karttunen, Aug 23 2019
STATUS
approved
