OFFSET
1,8
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
a(1) = 0 then a(n) = w(n) - a(n-w(n)) where w(n) = 7^floor(log(n-1)/log(7)).
a(n) = Sum_{i=1..n-1} (-1)^(i-1)*7^valuation(i, 7).
MATHEMATICA
a[n_] := Sum[(-1)^(i+1) * 7^IntegerExponent[i, 7], {i, 1, n-1}]; Array[a, 100] (* Amiram Eldar, Jun 17 2022 *)
PROG
(PARI) a(n)=if(n<2, 0, 7^floor(log(n-1)/log(7))-a(n-7^floor(log(n-1)/log(7))))
(PARI) a(n)=-sum(i=1, n-1, (-1)^i*7^valuation(i, 7))
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Apr 26 2004
STATUS
approved