A165256 Numbers whose number of distinct prime factors equals the number of digits in the number.
2, 3, 4, 5, 7, 8, 9, 10, 12, 14, 15, 18, 20, 21, 22, 24, 26, 28, 33, 34, 35, 36, 38, 39, 40, 44, 45, 46, 48, 50, 51, 52, 54, 55, 56, 57, 58, 62, 63, 65, 68, 69, 72, 74, 75, 76, 77, 80, 82, 85, 86, 87, 88, 91, 92, 93, 94, 95, 96, 98, 99, 102, 105, 110, 114, 120, 126, 130, 132
Offset: 1
Examples
The number of distinct prime factors of 4 is 1, which is the same as the number of digits in 4, so 4 is in the sequence. The number of distinct prime factors of 21 is 2, which is the same as the number of digits in 21, so 21 is in the sequence. However, 25 is NOT in the sequence because the number of distinct prime factors of 25 is 1, which does not match the number of digits in 25.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..7812 (complete sequence)
- Michael S. Branicky, Python program
Programs
-
Maple
omega := proc(n) nops(numtheory[factorset](n)) ; end: A055642 := proc(n) max(1, ilog10(n)+1) ; end: A165256 := proc(n) option remember; local a; if n = 1 then 2; else for a from procname(n-1)+1 do if A055642(a) = omega(a) then RETURN(a) ; fi; od: fi; end: seq(A165256(n),n=1..120) ; # R. J. Mathar, Sep 17 2009
-
Mathematica
Select[Range[200], IntegerLength[#] == Length[FactorInteger[#]] &] (* Harvey P. Dale, Mar 20 2011 *)
-
PARI
is(n)=#Str(n)==omega(n) \\ Charles R Greathouse IV, Feb 04 2013
-
Python
# see link for alternate version producing full sequence instantly from sympy import primefactors def ok(n): return len(primefactors(n)) == len(str(n)) print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Apr 13 2023
Extensions
Extended by R. J. Mathar, Sep 17 2009
Comments