PRIME FACTORS

A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.

A000040 The prime numbers.

2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83
A000040    OEIS
Fundamental theorem of arithmetic

Every positive integer n > 1 can be represented in exactly one way as a product of prime powers.

\[n=\prod_{p\epsilon \mathbb{P} }^{\infty}{p}^{\alpha_{n} }\]

\[n=60=2^{2}\cdot 3\cdot 5\]
\[15=3\times 5=3^{1}\times5^{1}\] \[30=2\times 3\times5=2^{1}\times3^{1}\times5^{1}\] \[60=2\times 2\times 3\times 5=2^{2}\times3^{1}\times5^{1}\]
\[299792458 = 2 \times 7 \times 73 \times 293339\] \[299792458^{2} = 89875517873681764 \\ =2^{2} \times 7^{2} \times 73^{2} \times 293339^{2}\]

A124010 Exponents in factorization of n.

0,1,1,2,1,1,1,1,3,2,1,1,1,2,1,1,1,1,1,1,4,1,1,2,1,2,1,1,1
A124010    OEIS

A027748 Lists distinct prime factors of n.

1,2,3,2,5,2,3,7,2,3,2,5,11,2,3,13,2,7,3,5,2,17,2,3,19,2,5,3
A027748    OEIS

A027746 Lists prime factors of n with repetition.

1,2,3,2,2,5,2,3,7,2,2,2,3,3,2,5,11,2,2,3,13
A027746    OEIS

A030231 Even number of distinct primes.

1,6,10,12,14,15,18,20,21,22,24,26,28,33,34,35,36,38,39,40,44,45
A030231    OEIS

A030230 Odd number of distinct primes.

2,3,4,5,7,8,9,11,13,16,17,19,23,25,27,29,30,31,32,37,41,42,43,47
A030230    OEIS

\[\Omega (n)\]

$$\Omega ~~~~ ~~~~ ~~~~ Omega $$

\[\Omega (n)=\sum_{p\epsilon \mathbb{P}}^{\infty}\alpha _{n}\]

Number of prime divisors of n counted with repetition.

A001222 Counted with multiplicity

0,1,1,2,1,2,1,3,2,2,1,3,1,2,2,4,1,3,1,3,2,2,1,4,2,2,3,3,1
A001222    OEIS

\[\omega (n)\]

$$\omega ~~~~ ~~~~ ~~~~ omega $$

Number of distinct primes dividing n.

A001221 Counted without repetition

0,1,1,1,1,2,1,1,1,2,1,2,1,2,2,1,1,2,1,2,2,2,1,2,1,2,1,2,1
A001221    OEIS

Obviously for a prime $p$ it follows that $\omega(p) = 1$.

When $n$ is a squarefree number then $\Omega(n) = \omega(n)$.
Otherwise $\Omega(n) > \omega(n)$.

$\omega(n)$ is an additive function, and it can be used to define a multiplicative function like the Möbius's function :
$\mu(n) = (-1)^{\omega(n)}$ (as long as n is squarefree).

A005117 Squarefree numbers.

1,2,3,5,6,7,10,11,13,14,15,17,19,21,22,23,26,29,30,31,33,34,35
A005117    OEIS

A020639 Lpf(n): least prime dividing n.

1,2,3,2,5,2,7,2,3,2,11,2,13,2,3,2,17,2,19,2,3,2,23,2,5,2,3,2
A020639    OEIS

A007947 Largest squarefree number.

1,2,3,2,5,6,7,2,3,10,11,6,13,14,15,2,17,6,19,10,21,22,23,6,5
A007947    OEIS

A006530 Gpf(n): greatest prime dividing n.

1,2,3,2,5,3,7,2,3,5,11,3,13,7,5,2,17,3,19,5,7,11,23,3,5,13,3
A006530    OEIS

A008472 Sum of distinct primes dividing n.

0,2,3,2,5,5,7,2,3,7,11,5,13,9,8,2,17,5,19,7,10,13,23,5,5,15,3
A008472    OEIS

table([(n,factor(n)) for n in [1..60]], header_row=['n', 'Factorization of n'])

L = [factor(n) for n in range(1, 60)]
print L



#
n=2520
# Factorization
factor(n)
#list of prime factors with exponents
list(factor(n))
#number of prime factors
len(factor(n))

f = factor(n); f
[p^e for p,e in f]
[p for p,e in f]
[e for p,e in f]

import numpy as np
L = np.array([p^e for p,e in f])
list(L).count(1)
from collections import Counter
Counter(L)


2^3 * 3^2 * 5 * 7
[(2, 3), (3, 2), (5, 1), (7, 1)]
4

2^3 * 3^2 * 5 * 7
[8, 9, 5, 7]
[2, 3, 5, 7]
[3, 2, 1, 1]

0
Counter({8: 1, 9: 1, 5: 1, 7: 1})

n=2520
f = factor(n); f
[p^e for p,e in f]
#A001221
len([p for p,e in f])
#A001222
sum([e for p,e in f])

2^3 * 3^2 * 5 * 7
[8, 9, 5, 7]
4
7

n=2520
prime_divisors(n)

[2, 3, 5, 7]