login
A338379
Floor of (digital root of n) divided by (number of digits in n).
1
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1, 1, 2, 2
OFFSET
0,3
LINKS
EXAMPLE
For n = 12345 the length of n is 5 (because 12345 has 5 digits) and its digital root is 6 (1+2+3+4+5=15 then 1+5=6). Then [6/5]=1 (where [x] is the integer part of x). Therefore a(12345)=0.
MATHEMATICA
Array[Floor[If[#1 == 0, 0, (#2 /. 0 -> 9)/IntegerLength[#1]]] & @@ {#, Mod[#, 9]} &, 105, 0] (* Michael De Vlieger, Nov 05 2020 *)
PROG
(Python)
#Defines digital root
def recsum(n):
nstr = str(n)
if len(nstr) == 1:
return int(nstr)
else:
nl = sum([int(j) for j in nstr])
return recsum(nl)
#Prints first 1000 terms
for i in range(1000):
print(recsum(i)//len(str(i)))
(PARI) a(n) = if (n, (n-1)%9+1, 0) \ #Str(n); \\ Michel Marcus, Nov 05 2020
CROSSREFS
Cf. A010888 (digital root of n), A055642 (length of n).
Sequence in context: A031298 A004428 A004429 * A004426 A262188 A358647
KEYWORD
nonn,base
AUTHOR
Fernando Villanueva, Oct 23 2020
STATUS
approved