OFFSET
1,2
COMMENTS
Even if a prime divides n more than once, it is only counted once.
Inverse Möbius transform of (n mod 10) * c(n), where c(n) is the prime characteristic (A010051). - _Wesley Ivan Hurt_, Jun 23 2024
FORMULA
a(n) = Sum_{p|n, p prime} (p mod 10).
a(n) = Sum_{d|n} (d mod 10) * c(d), where c = A010051. - _Wesley Ivan Hurt_, Jun 23 2024
EXAMPLE
a(66) = 6; The distinct prime divisors of 66 are 2, 3, 11 and the sum of their final digits is 2 + 3 + 1 = 6.
MATHEMATICA
a[n_]:=Total[Mod[Select[Divisors[n], PrimeQ], 10]]; Array[a, 85] (* _Stefano Spezia_, Nov 19 2023 *)
PROG
(Python)
from sympy import factorint
def a(n): return sum(p%10 for p in factorint(n))
print([a(n) for n in range(1, 86)]) # _Michael S. Branicky_, Nov 19 2023
(PARI) a(n) = my(f=factor(n)); sum(k=1, #f~, f[k, 1] % 10); \\ _Michel Marcus_, Nov 21 2023
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
_Wesley Ivan Hurt_, Nov 19 2023
STATUS
approved