Welcome to math_util’s documentation!

Contents:

Indices and tables

class prime_factors.PrimeFactors(num=0, prime_factors=[])[source]

An easy-to-use Python wrapper to print prime factors of an integer

>>> from math_util import PrimeFactors
>>> prime_factors = PrimeFactors(15)
>>> list = prime_factors.compute_prime_factors()
>>> primt list
[3,5]
compute_prime_factors()[source]

Computes the prime fators for a given integer. :return: List of prime factors :rtype: list :raises PrimeFactor Error: if something unexpected happens

exception prime_factors.PrimeFactorsError(error)[source]

Base class for errors in the compute_prime_factors module.

Mehtods of the PrimeFactor raise this when unexpected behaviour occurs.

class prime_numbers.PrimeNumbers(lim)

Python wrapper to print prime number <= lim

An easy-to-use Python wrapper to print prime factors of an integer

>>> from math_util import PrimeNumebers
>>> prime_numbers = PrimeNumbers(11)
>>> list = prime_numbers.rwh()
>>> print list
[2,3,5,7,11]
rwh()

Prints prime numbers <= lim using sieve algorithm :return: List of prime numbers :rtype: list

Table Of Contents

This Page