A360074 a(n) is the greatest divisor of n divisible by the sum of its own digits.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 12, 1, 7, 5, 8, 1, 18, 1, 20, 21, 2, 1, 24, 5, 2, 27, 7, 1, 30, 1, 8, 3, 2, 7, 36, 1, 2, 3, 40, 1, 42, 1, 4, 45, 2, 1, 48, 7, 50, 3, 4, 1, 54, 5, 8, 3, 2, 1, 60, 1, 2, 63, 8, 5, 6, 1, 4, 3, 70, 1, 72, 1, 2, 5, 4, 7, 6, 1, 80
Offset: 1
Examples
For n = 32: - the divisors of 32 are 1, 2, 4, 8, 16 and 32, - 8 is divisible by 8 whereas 16 is not divisible by 1+6 and 32 is not divisible by 3+2, - so a(32) = 8.
Links
Programs
-
Mathematica
Table[Max[Select[Divisors[n],Mod[#,Total[IntegerDigits[#]]]==0&]],{n,80}] (* Harvey P. Dale, Sep 04 2023 *)
-
PARI
a(n) = fordiv (n, d, my (t=n/d); if (t%sumdigits(t)==0, return (t)))
Formula
a(n) = n iff n belongs to A005349.
Comments