The On-Line Encyclopedia of Integer Sequences gets regularly updated with new integer sequences. One of the recent updates was contributed by me, A285494.

A285494 is the list of all numbers so that its digit sum equals its number of distinct prime factors.

A number’s digit sum is the sum of all of its decimal digits. The number , for example, has a digit sum of .

A number’s number of distinct prime factors is the number of different prime numbers that multiply together to result in the original number. As an example, , so it has five prime factors of which four are distinct.

Thereby one can conclude that is not an entry in this sequence, as .

The sequence is certainly infinite, as the number with has a digit sum of and — because — exactly two distinct prime factors.

In the encyclopedia entry, I provided a Mathematica one-liner to compute the first few entries of this sequence. Since then, I have also written a Python two-liner to achieve the same goal.

```
(* Mathematica *)
Select[Range[2,10000],Total[IntegerDigits[#]]==Length[FactorInteger[#]]&]
Out = {20, 30, 102, 120, 200, 300, 1002, 1200, 2000, 2001, 2002, 3000, 3010}
```

```
# Python 2.7
>>> def p(n):exec"i,f=2,set()\nwhile n>1:\n\tif n%i==0:f.add(i);n/=i;i=1\n\ti+=1";return len(f)
>>> print filter(lambda n:p(n)==sum(map(int,str(n))),range(2,10001))
[20, 30, 102, 120, 200, 300, 1002, 1200, 2000, 2001, 2002, 3000, 3010]
```

### Like this:

Like Loading...