Jonathan. Frech’s WebBlog

A285494 (#171)

Jonathan Frech,

The On-Line Encyclopedia of In­te­ger Sequences gets regularly updated with new in­te­ger sequences. One of the recent updates was contributed by me, A285494.

A285494 is the list of all numbers 𝑘 so that its dig­it sum equals its num­ber of distinct prime factors.
A num­ber’s dig­it sum is the sum of all of its dec­i­mal digits. The num­ber 62831853, for example, has a dig­it sum of 6 + 2 + 8 + 3 + 1 + 8 + 5 + 3 = 36.
A num­ber’s num­ber of distinct prime factors is the num­ber of dif­fer­ent prime numbers that multiply to­geth­er to re­sult in the original num­ber. As an example, $62831853=3^2\cdot 7\cdot 127\cdot 7853$$62831853=3^2\cdot 7\cdot 127\cdot 7853$$62831853=3^2\cdot 7\cdot 127\cdot 7853$, so it has five prime factors of which four are distinct.
Thereby one can conclude that 62831853 is not an entry in this sequence, as $36\neq 4$$36\neq 4$$36\neq 4$.

The sequence is certainly infinite, as the num­ber $k=2\cdot 10^n$$k=2\cdot 10^n$$k=2\cdot 10^n$ with $n\in \mathbb{N}^*$$n\in \mathbb{N}^*$$n\in \mathbb{N}^*$ has a dig­it sum of $2+(0\cdot n)=2$$2+(0\cdot n)=2$$2+(0\cdot n)=2$ and — because $k=2^{n+1}\cdot 5^n$$k=2^{n+1}\cdot 5^n$$k=2^{n+1}\cdot 5^n$ — exactly two distinct prime factors.

In the encyclopedia entry, I pro­vid­ed a Mathematica one-liner to com­pute the first few entries of this sequence. Since then, I have also writ­ten 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]