Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #11 Jun 17 2022 03:42:03
%S 0,1,0,1,0,1,0,7,6,7,6,7,6,7,0,1,0,1,0,1,0,7,6,7,6,7,6,7,0,1,0,1,0,1,
%T 0,7,6,7,6,7,6,7,0,1,0,1,0,1,0,49,48,49,48,49,48,49,42,43,42,43,42,43,
%U 42,49,48,49,48,49,48,49,42,43,42,43,42,43,42,49,48,49,48,49,48,49,42,43
%N A 7-fractal "castle" starting with 0.
%H Amiram Eldar, <a href="/A093349/b093349.txt">Table of n, a(n) for n = 1..10000</a>
%F a(1) = 0 then a(n) = w(n) - a(n-w(n)) where w(n) = 7^floor(log(n-1)/log(7)).
%F a(n) = Sum_{i=1..n-1} (-1)^(i-1)*7^valuation(i, 7).
%t a[n_] := Sum[(-1)^(i+1) * 7^IntegerExponent[i, 7], {i, 1, n-1}]; Array[a, 100] (* _Amiram Eldar_, Jun 17 2022 *)
%o (PARI) a(n)=if(n<2,0,7^floor(log(n-1)/log(7))-a(n-7^floor(log(n-1)/log(7))))
%o (PARI) a(n)=-sum(i=1,n-1,(-1)^i*7^valuation(i,7))
%Y Cf. A093347, A093348
%K nonn
%O 1,8
%A _Benoit Cloitre_, Apr 26 2004