OFFSET
0,7
COMMENTS
The sequence S_5(n) starts 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, ... for n >= 0. Apart from the initial 0, these are blocks of 5 repetitions of 1, 2, 3, 4, 5, 6, 7, 6, 7, 8, 7, 6, 7, 8, 9, 10, 11, 12, 13, 14, ...
Theorem. The sequence is periodic with period 2560.
The theorem allows us to write a recursion for S_5(n), considering n modulo 2560: S_5(n) = 10*S_5(floor(n/16)) - 5*S_5(floor(n/256)) + (-1)^s_4(n)*a(n).
LINKS
Peter J. C. Moses, Table of n, a(n) for n = 0..2559
Vladimir Shevelev and Peter J. C. Moses, A family of digit functions with large periods, arXiv:1209.5705 [math.NT], 2012.
FORMULA
-9 <= a(n) <= 9, all 19 values are actually achieved.
EXAMPLE
a(n)=-9 for n=2411, 2412, 2414, 2491, 2492, 2494 (mod 2560);
a(n)=9 for n=2413, 2415, 2493, 2495 (mod 2560).
MAPLE
S := proc(n, j, x)
a := 0 ;
for r from j to x-1 by n do
add(d, d=convert(r, base, n-1)) ;
a := a+(-1)^% ;
end do:
a ;
end proc:
A218085 := proc(n)
S(5, 0, n)-10*S(5, 0, floor(n/16))+5*S(5, 0, floor(n/256)) ;
%*(-1)^A053737(n) ;
end proc:
seq(A218085(n), n=0..80) ; # R. J. Mathar, Oct 31 2012
CROSSREFS
KEYWORD
sign,base,easy
AUTHOR
Vladimir Shevelev and Peter J. C. Moses, Oct 20 2012
STATUS
approved