Skip to content

PrimeOmega ​

The number of prime factors of n, counted with multiplicity.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaPrime omega functionMathWorldPrimeFactorWikidataQ55630466OEISA001222Wolfram LanguagePrimeOmega✓
PrimeOmega(n)number of prime factors of nn, counted with multiplicity.
SageMathsum(e for _, e in factor(n))SymPyprimeomega(n)Juliaenumeratio_prime_omega(n)Rustprime_omega(n)
Typed signatures
TypePackageApplies
(integer) -> integercompute-enginealways
(number | quadratic_integer, any*) -> integernumber-theoryreplaces compute-enginealways

Domain: Number theory

Details
  • Counts every prime factor with multiplicity -- Ω(25)=5\Omega(2^5)=5, unlike PrimeNu's 1.
  • Completely additive: Ω(mn)=Ω(m)+Ω(n)\Omega(mn)=\Omega(m)+\Omega(n) for all m,nm,n, not just coprime ones.
  • Ω(1)=0\Omega(1)=0: 1 has no prime factors.
  • Ω(n)=ν(n)\Omega(n)=\nu(n) exactly when nn is squarefree; otherwise Ω(n)>ν(n)\Omega(n)>\nu(n).

Examples

Basic #
live ↗
InPrimeOmega(30)\mathrm{PrimeOmega}(30)Out33
live ↗
InPrimeOmega(360)\mathrm{PrimeOmega}(360)Out66
live ↗
InPrimeOmega(12)\mathrm{PrimeOmega}(12)Out33
Scope #

Threads element-wise over a list, as Wolfram's Listable heads do

live ↗
InPrimeOmega([4,12,24])\mathrm{PrimeOmega}(\bigl\lbrack4, 12, 24\bigr\rbrack)Out[2,3,4]\bigl\lbrack2, 3, 4\bigr\rbrack

Large integers

live ↗
InPrimeOmega(30!)\mathrm{PrimeOmega}(30!)Out5959

Gaussian integers: 5+9i5+9i has norm 106=2⋅53106=2\cdot53, so two prime factors

live ↗
InPrimeOmega(5+9i)\mathrm{PrimeOmega}(5+9i)Out22

GaussianIntegers -> True: 12=−(1+i)4⋅312=-(1+i)^4\cdot3

live ↗
InPrimeOmega(12,Rule(Over,GaussianIntegers))\mathrm{PrimeOmega}(12, \mathrm{Rule}(\mathrm{Over}, \mathrm{GaussianIntegers}))Out55

Listable over a Range

live ↗
InPrimeOmega(1..20)\mathrm{PrimeOmega}(1..20)Out[0,1,1,2,1,2,1,3,2,2,1,3,1,2,2,4,1,3,1,3]\bigl\lbrack0, 1, 1, 2, 1, 2, 1, 3, 2, 2, 1, 3, 1, 2, 2, 4, 1, 3, 1, 3\bigr\rbrack

28=22⋅728=2^2\cdot7 counts 2,2,72,2,7

live ↗
InPrimeOmega(28)\mathrm{PrimeOmega}(28)Out33

Negative nn: the sign is a unit, so Ω(−12)=Ω(12)\Omega(-12)=\Omega(12)

live ↗
InPrimeOmega(−12)\mathrm{PrimeOmega}(-12)Out33
Properties #

Completely additive: Ω(mn)=Ω(m)+Ω(n)\Omega(mn)=\Omega(m)+\Omega(n) for all m,nm,n

live ↗
InPrimeOmega(24×40)=PrimeOmega(24)+PrimeOmega(40)\mathrm{PrimeOmega}(24×40)=\mathrm{PrimeOmega}(24)+\mathrm{PrimeOmega}(40)OutTrue\mathrm{True}

Ω(n)≥ν(n)\Omega(n)\ge\nu(n) always; here 8=238=2^3 gives Ω=3\Omega=3 but ν=1\nu=1. See PrimeNu

live ↗
InPrimeOmega(8)≥PrimeNu(8)\mathrm{PrimeOmega}(8)≥\mathrm{PrimeNu}(8)OutTrue\mathrm{True}

100=22⋅52100=2^2\cdot5^2: repeated primes count each time

live ↗
InPrimeOmega(100)\mathrm{PrimeOmega}(100)Out44

16807=7516807=7^5, five factors from one prime

live ↗
InPrimeOmega(16 807)\mathrm{PrimeOmega}(16\,807)Out55

Squarefree 165=3⋅5⋅11165=3\cdot5\cdot11, so it matches PrimeNu

live ↗
InPrimeOmega(165)=PrimeNu(165)\mathrm{PrimeOmega}(165)=\mathrm{PrimeNu}(165)OutTrue\mathrm{True}

Never smaller than the distinct-prime count

live ↗
InAll(1..100,_1⁡↦PrimeNu(_1⁡)≤PrimeOmega(_1⁡))\mathrm{All}(1..100, \operatorname{\_1}↦\mathrm{PrimeNu}(\operatorname{\_1})≤\mathrm{PrimeOmega}(\operatorname{\_1}))OutTrue\mathrm{True}
Possible issues #

1 has no prime factors

live ↗
InPrimeOmega(1)\mathrm{PrimeOmega}(1)Out00
About
Examples17
Checked againstWolfram Language 17 agreeSageMath 13 agreeSymPy 12 agree2 errormathlib4 10 agree3 errorJulia 12 agree1 errorRust 11 agree2 error
CrosswalkWikipediaMathWorldWikidataOEISWolfram LanguageSageMathSymPyJuliaRust

Implementation

mappedsympypackages/oracle/src/mappings.ts

primeomega counts prime factors with multiplicity of an integer; a Gaussian integer is not one.

mappedsagepackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts
mappedrustpackages/oracle/src/mappings.ts

The number of primes in the factorization, with multiplicity.

mappedmathlib4packages/oracle/src/mappings.ts

ArithmeticFunction.cardFactors, Omega(n): prime factors with multiplicity, Omega(0) = 0; natural n only.

See also: PrimeNu, FactorInteger