A330348 a(n) is the number of divisors of n whose last digit equals the last digit of n.
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, 1, 3, 2, 2, 1, 2, 3, 1, 1, 2, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 4, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 3, 1, 1, 4, 1, 2, 1, 1, 4, 2, 2, 1, 3, 2, 1, 1, 2, 1
Offset: 1
Examples
The divisors of 12 that end in 2 are 2 and 12, so a(12) = 2.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Project Euler, Problem 474: Last digits of divisors
Programs
-
Maple
f:= proc(n) local t; t:= n mod 10; nops(select(k -> k mod 10 = t, numtheory:-divisors(n))) end proc: map(f, [$1..100]); # Robert Israel, Jun 04 2020
-
Mathematica
a[n_] := DivisorSum[n, 1 &, Mod[# - n, 10] == 0 &]; Array[a, 100] (* Amiram Eldar, Jun 04 2020 *)
-
PARI
a(n) = my(u=n%10); sumdiv(n, d, d%10 == u); \\ Michel Marcus, Jun 04 2020
-
Python
from sympy import divisors def a(n): return sum((n-d)%10 == 0 for d in divisors(n, generator=True)) print([a(n) for n in range(1, 90)]) # Michael S. Branicky, Aug 15 2022
Comments