This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A338822 #61 Sep 08 2022 08:46:25 %S A338822 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, %T A338822 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, %U A338822 0,1,0,3,0,1,0,1,0,1,0,1,0,2,0,3,0,1,0,2,0,1,0 %N A338822 a(n) is the number of divisors of n whose last digits equal the number of digits of n. %C A338822 Inspired by Project Euler, Problem 474 (see link). %C A338822 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. %C A338822 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. %C A338822 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 %H A338822 Robert Israel, <a href="/A338822/b338822.txt">Table of n, a(n) for n = 1..10000</a> %H A338822 Project Euler, <a href="https://projecteuler.net/problem=474">Problem 474: Last digits of divisors</a>. %F A338822 For 1-digit numbers: a(n) = 1. %F A338822 For 2-digit numbers: a(n) = 0 iff n is odd, a(n) >= 1 if n is even. %F A338822 For 4-digit numbers: a(n) = 0 if n is odd. %F A338822 For 5-digit numbers, a(n) >= 2 if n ends with 5, a(n) >=1 if n ends with 0, otherwise a(n) = 0. %F A338822 For 8-digit numbers, a(n) = 0 if n is odd. %e A338822 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. %e A338822 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. %p A338822 f:= proc(n) local d, dd; %p A338822 d:= ilog10(n)+1; %p A338822 dd:= ilog10(d)+1; %p A338822 nops(select(t -> t mod 10^dd = d, numtheory:-divisors(n))) %p A338822 end proc: %p A338822 map(f, [$1..100]); # _Robert Israel_, Nov 12 2020 %t A338822 a[n_] := DivisorSum[n, 1 &, Divisible [# - (ndigit = IntegerLength[n]), 10^IntegerLength[ndigit]] &]; Array[a, 100] (* _Amiram Eldar_, Nov 12 2020 *) %o A338822 (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 %o A338822 (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 %Y A338822 Cf. A000005, A330348. %K A338822 nonn,base %O A338822 1,12 %A A338822 _Bernard Schott_, Nov 11 2020 %E A338822 Name generalized following remark of _Marius A. Burtea_, Nov 12 2020