login
A385105
Harshad root of integer n: the largest integer produced by repeatedly dividing n by its digit sum until it fails to produce another integer or it reaches a power of 10.
4
1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 11, 1, 13, 14, 15, 16, 17, 1, 19, 10, 1, 22, 23, 1, 25, 26, 1, 28, 29, 10, 31, 32, 33, 34, 35, 1, 37, 38, 39, 10, 41, 1, 43, 44, 1, 46, 47, 1, 49, 10, 51, 52, 53, 1, 55, 56, 57, 58, 59, 10, 61, 62, 1, 64, 65, 66, 67, 68, 69, 10, 71, 1, 73, 74, 75, 76, 77, 78, 79
OFFSET
1,10
COMMENTS
a(102) = 34 is the least integer without itself or a power of 10 as a root.
LINKS
Eric Weisstein's World of Mathematics, Harshad Numbers.
Wikipedia, Harshad number.
EXAMPLE
a(20) = 10 since 20/(2+0) = 10 and 10 loops to itself.
MATHEMATICA
a[n_] := NestWhile[# / DigitSum[#] &, n, DigitSum[#] > 1 && Divisible[#, DigitSum[#]] &]; Array[a, 100] (* Amiram Eldar, Sep 27 2025 *)
PROG
(Python)
def a(n):
while n % (digsum:=sum([int(d) for d in str(n)])) == 0 and digsum != 1:
n//=digsum
return n
print([a(n) for n in range(1, 80)])
(PARI) a(n) = {my(r=n, s); while((s=sumdigits(r)) != 1 && r%s==0, r/=s); r} \\ Andrew Howroyd, Sep 26 2025
CROSSREFS
Cf. A005349 (Harshad numbers), A188641 (characteristic function of Harshad numbers), A389235 (final values).
Sequence in context: A324660 A336035 A334676 * A176998 A328752 A173821
KEYWORD
nonn,base,easy
AUTHOR
James Carruthers, Sep 25 2025
STATUS
approved