OFFSET
1,1
EXAMPLE
21 is a term since its digits sum to 2 + 1 = 3 and it has three proper divisors (1, 3, and 7).
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 &]
PROG
(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
(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);
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Zdenek Cervenka, Feb 21 2022
STATUS
approved