login
A289411
a(n) = Sum_{k=0..n} sign(A007953(5*k) - A007953(k)).
2
0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 8, 9, 8, 9, 8, 9, 8, 8, 7, 6, 7, 8, 9, 10, 11, 12, 12, 13, 12, 13, 12, 13, 12, 13, 12, 12, 11, 10, 9, 8, 9, 10, 11, 12, 12, 13, 12, 13, 12, 13, 12, 13, 12, 12, 11, 10, 9, 8, 7, 6, 7, 8, 8, 9, 8, 9, 8
OFFSET
0,12
COMMENTS
The sign function is defined by:
- sign(0) = 0,
- sign(n) = +1 for any n > 0,
- sign(n) = -1 for any n < 0.
The graph of the sequence has some similarities with a Takagi (or blancmange) curve.
Visually, the sequence is of fractal nature; for k > 2, the scatterplot of the first 10^k terms is similar to that of the first 10^(k+1) terms.
We also have symmetries:
- for k = 1..6: let m_k = (10^k)/2-1: for i = 0..m_k, we have a(m_k - i) = a(m_k + i),
- this relation is conjectured to hold for any k > 0,
- this would be equivalent to saying that, for any k > 0 and i = 0..m_k, sign(A007953(5*(m_k - i)) - A007953(m_k - i)) = - sign(A007953(5*(m_k + i + 1)) - A007953(m_k + i + 1)).
For b > 1, let d_b be the digital sum in base b; in particular:
- d_2 = A000120,
- d_3 = A053735,
- d_10 = A007953.
For any b > 1 and n >= 0, d_b(b*n) = d_b(n).
Also, a(n) = Sum_{k=0..n} sign(d_10(5*k) - d_10(k)).
For b > 1, i > 0 and j > 0 such that neither i nor j are divisible by b, let F(b,i,j) be the function defined by n -> Sum_{k=0..n} sign(d_b(i*k) - d_b(j*k)); in particular:
- F(10,5,1) = a (this sequence).
Also, F(b,i,i) = 0 and F(b,i,j) = -F(b,j,i).
Conjecturally, we have three kinds of behaviors:
- if i = j, then F(b,i,j) = 0,
- otherwise if i and j divide b, then F(b,i,j) has infinitely many zeros (and infinitely many nonzero values), and has similar fractal nature and exhibits similar symmetries as the present sequence,
- otherwise |F(b,i,j)| tends to infinity (and has only a finite number of zeros).
a(n) = 0 for n = 0, 2, 4, 6, 8, 9, 89, 90, 92, 94, 96, 98, 99, 899, 900, 902, 904, 906, 908, 909, 989, 990, 992, 994, 996, 998, 999, 8999, ...
EXAMPLE
The first terms, alongside the digital sum of 5*n and n, and the sign of their difference, are:
n a(n) d_10(5*n) d_10(n) sign
-- ---- --------- ------- ----
0 0 0 0 0
1 1 5 1 +1
2 0 1 2 -1
3 1 6 3 +1
4 0 2 4 -1
5 1 7 5 +1
6 0 3 6 -1
7 1 8 7 +1
8 0 4 8 -1
9 0 9 9 0
10 1 5 1 +1
11 2 10 2 +1
12 3 6 3 +1
13 4 11 4 +1
14 5 7 5 +1
15 6 12 6 +1
16 7 8 7 +1
17 8 13 8 +1
18 8 9 9 0
19 9 14 10 +1
20 8 1 2 -1
21 9 6 3 +1
22 8 2 4 -1
23 9 7 5 +1
24 8 3 6 -1
25 9 8 7 +1
MATHEMATICA
With[{s = Table[Total@ IntegerDigits[5 k] - Total@ IntegerDigits@ k, {k, 0, 76}]}, Table[Total@ Map[Sign, Take[s, n]], {n, Length@ s}]] (* Michael De Vlieger, Jul 20 2017 *)
PROG
(PARI) a(n) = sum(k=0, n, sign(sum digits(5*k) - sum digits(k)))
(Python)
from sympy import sign
from sympy.ntheory.factor_ import digits
def a(n): return sum([sign(sum(digits(5*k)[1:]) - sum(digits(k)[1:])) for k in range(n + 1)])
print([a(n) for n in range(51)]) # Indranil Ghosh, Aug 02 2017
CROSSREFS
KEYWORD
nonn,base,look
AUTHOR
Rémy Sigrist, Jul 18 2017
STATUS
approved