OFFSET
1,3
COMMENTS
Any natural number n can be represented as n = (k_1)^p_1 * (k_2)^p_2 * ... * (k_h)^p_h, where k_i is prime for any i from 1 to h. Let us consider the function omega(n) = h, which represents the number of distinct prime factors of n. Then a(k) is the number of positive integers j less than k for which the value of function omega(j) is <= omega(k).
a(Q) = Q - 1 for Q a primorial number in A002110.
Let us consider n > k such that omega(n) = omega(k) = omega and there is no w such that n > w > k and omega(w) > omega. Hence a(n) - a(k) = n - k.
LINKS
Felix Fröhlich, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 0: 1 has no predecessor, omega(1) = 0 by convention;
a(2) = 1 because omega(2) = 1, 1 >= omega(0);
a(3) = 2 because omega(3) = 1 and none of omega(1), omega(2) >= 1;
a(4) = 3 because omega(4) = 1 and none of omega(1), omega(2), omega(3) >= 1.
MATHEMATICA
a[n_] := Block[{t = PrimeNu[n]}, Length@ Select[Range[n - 1], PrimeNu[#] <= t &]]; Array[a, 70] (* Giovanni Resta, Dec 10 2019 *)
PROG
(Python)
def primes(n):
divisors = [ d for d in range(2, n//2+1) if n % d == 0 ]
return [ d for d in divisors if \
all( d % od != 0 for od in divisors if od != d ) ]
pprimes = {}
for i in range(1, 10000):
res = len(primes(i))
if res == 0:
res = 1
pprimes[i] = res
for k in range(1, 10000):
s = 0
for i in range(1, k):
if pprimes[i] <= pprimes[k]:
s+=1
print(s)
(PARI) for(n=1, 70, my(omn=omega(n), m=0); for(k=1, n-1, if(omega(k)<=omn, m++)); print1(m, ", ")) \\ Hugo Pfoertner, Dec 10 2019
(PARI) a(n) = my(omn=omega(n)); sum(k=1, n-1, omega(k) <= omn); \\ Michel Marcus, Dec 11 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Dilshod Urazov, Dec 10 2019
EXTENSIONS
More terms from Giovanni Resta, Dec 10 2019
STATUS
approved