login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A 3-fractal "castle" starting with 0.
10

%I #16 Jan 01 2024 08:02:46

%S 0,1,0,3,2,3,0,1,0,9,8,9,6,7,6,9,8,9,0,1,0,3,2,3,0,1,0,27,26,27,24,25,

%T 24,27,26,27,18,19,18,21,20,21,18,19,18,27,26,27,24,25,24,27,26,27,0,

%U 1,0,3,2,3,0,1,0,9,8,9,6,7,6,9,8,9,0,1,0,3,2,3,0,1,0,81,80,81,78,79,78,81

%N A 3-fractal "castle" starting with 0.

%H Amiram Eldar, <a href="/A093347/b093347.txt">Table of n, a(n) for n = 1..10000</a>

%H Benoit Cloitre, <a href="https://web.archive.org/web/20050426011033/http://ns3131.ovh.net/~pi314/temporaires/benoit/Chateau_trifractal_pour_n_allant_de_1_a_9.JPG">Graph of a(n) for n=1 up to 9</a>

%H Benoit Cloitre, <a href="https://web.archive.org/web/20050426011033/http://ns3131.ovh.net/~pi314/temporaires/benoit/Chateau_trifractal_pour_n_allant_de_1_a_27.JPG">Graph of a(n) for n=1 up to 27</a>

%H Benoit Cloitre, <a href="https://web.archive.org/web/20050426011033/http://ns3131.ovh.net/~pi314/temporaires/benoit/Chateau_trifractal_pour_n_allant_de_1_a_81.JPG">Graph of a(n) for n=1 up to 81</a>

%H Benoit Cloitre, <a href="https://web.archive.org/web/20050426011033/http://ns3131.ovh.net/~pi314/temporaires/benoit/Chateau_trifractal_pour_n_allant_de_1_a_243.JPG">Graph of a(n) for n=1 up to 243</a>

%F a(1) = 0 then a(n) = w(n) - a(n-w(n)) where w(n) = 3^floor(log(n-1)/log(3)).

%F a(3^n) = 0, a(3^n+1) = 3^n, a(3^n+2) = 3^n-1, a(3^n+3) = 3^n, etc.

%F a(n) = Sum_{i=1..n-1} (-1)^(i-1)*3^valuation(i, 3).

%t a[n_] := Sum[(-1)^(i+1) * 3^IntegerExponent[i, 3], {i, 1, n-1}]; Array[a, 100] (* _Amiram Eldar_, Jun 17 2022 *)

%o (PARI) a(n)=if(n<2,0,3^floor(log(n-1)/log(3))-a(n-3^floor(log(n-1)/log(3))))

%o (PARI) a(n) = my(s=-1); fromdigits([if(d==1,s=-s) |d<-digits(n-1,3)], 3); \\ _Kevin Ryde_, Jan 01 2024

%Y Cf. A093348, A093349

%Y Cf. A038500.

%K nonn,easy

%O 1,4

%A _Benoit Cloitre_, Apr 26 2004