A351842 Numbers whose sum of digits and number of proper divisors are equal.
21, 32, 50, 70, 111, 162, 168, 201, 212, 232, 250, 308, 322, 380, 384, 405, 416, 430, 456, 546, 610, 650, 690, 740, 744, 812, 832, 870, 980, 1004, 1011, 1015, 1053, 1101, 1105, 1222, 1316, 1352, 1365, 1460, 1464, 1482, 1510, 1518, 1550, 1554, 1590, 1608, 1752
Offset: 1
Examples
21 is a term since its digits sum to 2 + 1 = 3 and it has three proper divisors (1, 3, and 7).
Programs
-
Maple
S := n -> add(convert(n, base, 10)): PD := n -> nops(NumberTheory[Divisors](n)) - 1: a := n -> select(x -> S(x) = PD(x), [seq(1..n)])
-
Mathematica
Select[Range[1, 1700], Total[IntegerDigits[#]] == Length[Divisors[#]] - 1 &]
-
PARI
isok(m) = sumdigits(m) == numdiv(m) - 1; \\ Michel Marcus, Feb 21 2022
-
PARI
list(nn) = forcomposite(n=1, nn, if (sumdigits(n) == (numdiv(n) - 1), print1(n, ", "))); list(1700);
-
Python
from sympy import divisor_count def ok(n): return sum(map(int, str(n))) == divisor_count(n) - 1 print([k for k in range(1753) if ok(k)]) # Michael S. Branicky, Feb 21 2022