login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A338379 Floor of (digital root of n) divided by (number of digits in n). 1

%I #27 Nov 20 2020 09:31:39

%S 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,

%T 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,

%U 2,3,3,4,4,0,1,1,2,2,3,3,4,4,0,1,1,2,2

%N Floor of (digital root of n) divided by (number of digits in n).

%H Fernando Villanueva, <a href="/A338379/b338379.txt">Table of n, a(n) for n = 0..9999</a>

%e 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.

%t Array[Floor[If[#1 == 0, 0, (#2 /. 0 -> 9)/IntegerLength[#1]]] & @@ {#, Mod[#, 9]} &, 105, 0] (* _Michael De Vlieger_, Nov 05 2020 *)

%o (Python)

%o #Defines digital root

%o def recsum(n):

%o nstr = str(n)

%o if len(nstr) == 1:

%o return int(nstr)

%o else:

%o nl = sum([int(j) for j in nstr])

%o return recsum(nl)

%o #Prints first 1000 terms

%o for i in range(1000):

%o print(recsum(i)//len(str(i)))

%o (PARI) a(n) = if (n, (n-1)%9+1, 0) \ #Str(n); \\ _Michel Marcus_, Nov 05 2020

%Y Cf. A010888 (digital root of n), A055642 (length of n).

%K nonn,base

%O 0,3

%A _Fernando Villanueva_, Oct 23 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 18 20:21 EDT 2024. Contains 375276 sequences. (Running on oeis4.)