Skip to content

PrimeNu ​

The number of distinct prime factors of n.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaPrime omega functionMathWorldDistinctPrimeFactorsWikidataQ55630466DLMF27.2.i.p1OEISA001221Wolfram LanguagePrimeNu✓
PrimeNu(n)number of distinct prime factors of nn.
SageMathlen(prime_divisors(n))SymPyprimenu(n)Juliaenumeratio_prime_nu(n)Rustprime_nu(n)
Typed signatures
TypePackageApplies
(integer) -> integercompute-enginealways
(number | quadratic_integer, any*) -> integernumber-theoryreplaces compute-enginealways

Domain: Number theory

Details
  • Counts distinct primes only -- ν(25)=1\nu(2^5)=1, not 5.
  • Equal to the length of FactorInteger(n)(n).
  • ν(1)=0\nu(1)=0: 1 has no prime factors.
  • Always ν(n)≤Ω(n)\nu(n)\le\Omega(n), with equality exactly when nn is squarefree. See PrimeOmega.

Examples

Basic #
live ↗
InPrimeNu(24)\mathrm{PrimeNu}(24)Out22
live ↗
InPrimeNu(360)\mathrm{PrimeNu}(360)Out33
live ↗
InPrimeNu(105)\mathrm{PrimeNu}(105)Out33
Scope #

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

live ↗
InPrimeNu([4,28,180])\mathrm{PrimeNu}(\bigl\lbrack4, 28, 180\bigr\rbrack)Out[1,2,3]\bigl\lbrack1, 2, 3\bigr\rbrack

Large integers: the 15 primes up to 50 divide 50!50!

live ↗
InPrimeNu(50!)\mathrm{PrimeNu}(50!)Out1515

Gaussian integers: 3+i=(1+i)(2−i)3+i=(1+i)(2-i)

live ↗
InPrimeNu(3+i)\mathrm{PrimeNu}(3+i)Out22

GaussianIntegers -> True: 55 splits, so 105105 has 4 Gaussian prime factors

live ↗
InPrimeNu(105,Rule(Over,GaussianIntegers))\mathrm{PrimeNu}(105, \mathrm{Rule}(\mathrm{Over}, \mathrm{GaussianIntegers}))Out44

Listable over a Range

live ↗
InPrimeNu(1..20)\mathrm{PrimeNu}(1..20)Out[0,1,1,1,1,2,1,1,1,2,1,2,1,2,2,1,1,2,1,2]\bigl\lbrack0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2\bigr\rbrack

Counts distinct primes: 2,3,52,3,5

live ↗
InPrimeNu(30)\mathrm{PrimeNu}(30)Out33

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

live ↗
InPrimeNu(−12)\mathrm{PrimeNu}(-12)Out22
Applications #

For squarefree nn, μ(n)=(−1)ω(n)\mu(n)=(-1)^{\omega(n)}

live ↗
InMoebiusMu(42)=(−1)PrimeNu(42)\mathrm{MoebiusMu}(42)=(-1)^{\mathrm{PrimeNu}(42)}OutTrue\mathrm{True}

Squarefree numbers also have λ(n)=(−1)ω(n)\lambda(n)=(-1)^{\omega(n)}

live ↗
InLiouvilleLambda(42)=(−1)PrimeNu(42)\mathrm{LiouvilleLambda}(42)=(-1)^{\mathrm{PrimeNu}(42)}OutTrue\mathrm{True}
Properties #

PrimeNu(n) is the length of FactorInteger(n)

live ↗
InPrimeNu(50)=Length(FactorInteger(50))\mathrm{PrimeNu}(50)=\mathrm{Length}(\mathrm{FactorInteger}(50))OutTrue\mathrm{True}

50=2⋅5250=2\cdot5^2: repeated primes count once

live ↗
InPrimeNu(50)\mathrm{PrimeNu}(50)Out22

Additive over coprime factors 99 and 4040

live ↗
InPrimeNu(360)=PrimeNu(9)+PrimeNu(40)\mathrm{PrimeNu}(360)=\mathrm{PrimeNu}(9)+\mathrm{PrimeNu}(40)OutTrue\mathrm{True}

A prime square has one distinct prime

live ↗
InPrimeNu(49)\mathrm{PrimeNu}(49)Out11

Equal to PrimeOmega when nn is squarefree

live ↗
InPrimeNu(210)=PrimeOmega(210)\mathrm{PrimeNu}(210)=\mathrm{PrimeOmega}(210)OutTrue\mathrm{True}

Squarefree 33=3⋅1133=3\cdot11 gives μ=1\mu=1, ω=2\omega=2

live ↗
InMoebiusMu(33)=(−1)PrimeNu(33)\mathrm{MoebiusMu}(33)=(-1)^{\mathrm{PrimeNu}(33)}OutTrue\mathrm{True}

Same parity rule for λ\lambda at a squarefree number

live ↗
InLiouvilleLambda(33)=(−1)PrimeNu(33)\mathrm{LiouvilleLambda}(33)=(-1)^{\mathrm{PrimeNu}(33)}OutTrue\mathrm{True}

A prime has ω=1\omega=1

live ↗
InPrimeNu(2)\mathrm{PrimeNu}(2)Out11

Known value · Wolfram MathematicalFunctionData, PrimeNu

Again one distinct prime

live ↗
InPrimeNu(3)\mathrm{PrimeNu}(3)Out11

Known value · Wolfram MathematicalFunctionData, PrimeNu

6=2⋅36=2\cdot3

live ↗
InPrimeNu(6)\mathrm{PrimeNu}(6)Out22

Known value · Wolfram MathematicalFunctionData, PrimeNu

222^2 has just one distinct prime

live ↗
InPrimeNu(4)\mathrm{PrimeNu}(4)Out11

Known value · Wolfram MathematicalFunctionData, PrimeNu

ω(n)≤Ω(n)\omega(n)\le\Omega(n) for every n≤99n\le99

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 #

32=2532=2^5 has just one distinct prime factor despite the high power

live ↗
InPrimeNu(32)\mathrm{PrimeNu}(32)Out11

1 has no prime factors

live ↗
InPrimeNu(1)\mathrm{PrimeNu}(1)Out00
About
Examples26
Checked againstWolfram Language 26 agreeSageMath 23 agreeSymPy 19 agree2 errormathlib4 20 agree3 errorJulia 21 agree1 errorRust 15 agree2 error
CrosswalkWikipediaMathWorldWikidataDLMFOEISWolfram LanguageSageMathSymPyJuliaRust

Implementation

mappedsympypackages/oracle/src/mappings.ts

primenu counts distinct prime factors 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.

mappedmathlib4packages/oracle/src/mappings.ts

ArithmeticFunction.cardDistinctFactors, omega(n): distinct prime factors, omega(0) = 0; natural n only.

See also: PrimeOmega, FactorInteger