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.
%I A093347 #16 Jan 01 2024 08:02:46 %S A093347 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 A093347 24,27,26,27,18,19,18,21,20,21,18,19,18,27,26,27,24,25,24,27,26,27,0, %U A093347 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 A093347 A 3-fractal "castle" starting with 0. %H A093347 Amiram Eldar, <a href="/A093347/b093347.txt">Table of n, a(n) for n = 1..10000</a> %H A093347 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 A093347 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 A093347 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 A093347 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 A093347 a(1) = 0 then a(n) = w(n) - a(n-w(n)) where w(n) = 3^floor(log(n-1)/log(3)). %F A093347 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 A093347 a(n) = Sum_{i=1..n-1} (-1)^(i-1)*3^valuation(i, 3). %t A093347 a[n_] := Sum[(-1)^(i+1) * 3^IntegerExponent[i, 3], {i, 1, n-1}]; Array[a, 100] (* _Amiram Eldar_, Jun 17 2022 *) %o A093347 (PARI) a(n)=if(n<2,0,3^floor(log(n-1)/log(3))-a(n-3^floor(log(n-1)/log(3)))) %o A093347 (PARI) a(n) = my(s=-1); fromdigits([if(d==1,s=-s) |d<-digits(n-1,3)], 3); \\ _Kevin Ryde_, Jan 01 2024 %Y A093347 Cf. A093348, A093349 %Y A093347 Cf. A038500. %K A093347 nonn,easy %O A093347 1,4 %A A093347 _Benoit Cloitre_, Apr 26 2004