login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A338822
a(n) is the number of divisors of n whose last digits equal the number of digits of n.
1
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 1, 0, 2, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 1, 0, 1, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 0, 1, 0, 3, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 3, 0, 1, 0, 2, 0, 1, 0
OFFSET
1,12
COMMENTS
Inspired by Project Euler, Problem 474 (see link).
If in the name, one replaces “whose last digits equal” with “whose last digit equals” then, this sequence is finite and the last term should be a(999999999) = 5 because 999999999 has 9 digits and among the 20 divisors of 999999999, five of them (9, 999, 9009009, 12345679 and 999999999) have the last digit 9.
With this name, the next term is a(10^9) = 1 because 10^9 has 10 digits and among the 100 divisors of 10^9, only one of them (10) ends with 10.
For p prime, p >= 7, the number 10^(p - 1) + p - 1 is divisible by p and the number of digits is p, so it has at least one divisor that ends in p. Thus, there is an infinity of terms a(k) > 0. - Marius A. Burtea, Nov 12 2020
FORMULA
For 1-digit numbers: a(n) = 1.
For 2-digit numbers: a(n) = 0 iff n is odd, a(n) >= 1 if n is even.
For 4-digit numbers: a(n) = 0 if n is odd.
For 5-digit numbers, a(n) >= 2 if n ends with 5, a(n) >=1 if n ends with 0, otherwise a(n) = 0.
For 8-digit numbers, a(n) = 0 if n is odd.
EXAMPLE
72 has 2 digits, and among the divisors of 72 (1, 2, 3, 4, 6, 12, 18, 24, 36, 72), three of them (2, 12 and 72) have the last digit 2, hence a(72) = 3.
111 has 3 digits, and among the divisors of 111 (1, 3, 37, 111), only one of them (3) has the last digit 3, hence a(111) = 1.
MAPLE
f:= proc(n) local d, dd;
d:= ilog10(n)+1;
dd:= ilog10(d)+1;
nops(select(t -> t mod 10^dd = d, numtheory:-divisors(n)))
end proc:
map(f, [$1..100]); # Robert Israel, Nov 12 2020
MATHEMATICA
a[n_] := DivisorSum[n, 1 &, Divisible [# - (ndigit = IntegerLength[n]), 10^IntegerLength[ndigit]] &]; Array[a, 100] (* Amiram Eldar, Nov 12 2020 *)
PROG
(Magma) [#[d:d in Divisors(n) | d mod 10^(#Intseq(#Intseq(n))) eq #Intseq(n)]:n in [1..100]]; // Marius A. Burtea, Nov 12 2020
(PARI) a(n) = my(nb = #Str(n), nc = #Str(nb)); sumdiv(n, d, if (d<nb, 0, !((d-nb) % (10^nc)))); \\ Michel Marcus, Nov 16 2020
CROSSREFS
Sequence in context: A085854 A216188 A117145 * A083912 A256003 A157187
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Nov 11 2020
EXTENSIONS
Name generalized following remark of Marius A. Burtea, Nov 12 2020
STATUS
approved