maths.basic_maths

Implementation of Basic Math in Python.

Functions

euler_phi(→ int)

Calculate Euler's Phi Function.

number_of_divisors(→ int)

Calculate Number of Divisors of an Integer.

prime_factors(→ list)

Find Prime Factors.

sum_of_divisors(→ int)

Calculate Sum of Divisors.

Module Contents

maths.basic_maths.euler_phi(n: int) int

Calculate Euler’s Phi Function. >>> euler_phi(100) 40 >>> euler_phi(0) Traceback (most recent call last):

ValueError: Only positive numbers are accepted >>> euler_phi(-10) Traceback (most recent call last):

ValueError: Only positive numbers are accepted

maths.basic_maths.number_of_divisors(n: int) int

Calculate Number of Divisors of an Integer. >>> number_of_divisors(100) 9 >>> number_of_divisors(0) Traceback (most recent call last):

ValueError: Only positive numbers are accepted >>> number_of_divisors(-10) Traceback (most recent call last):

ValueError: Only positive numbers are accepted

maths.basic_maths.prime_factors(n: int) list

Find Prime Factors. >>> prime_factors(100) [2, 2, 5, 5] >>> prime_factors(0) Traceback (most recent call last):

ValueError: Only positive integers have prime factors >>> prime_factors(-10) Traceback (most recent call last):

ValueError: Only positive integers have prime factors

maths.basic_maths.sum_of_divisors(n: int) int

Calculate Sum of Divisors. >>> sum_of_divisors(100) 217 >>> sum_of_divisors(0) Traceback (most recent call last):

ValueError: Only positive numbers are accepted >>> sum_of_divisors(-10) Traceback (most recent call last):

ValueError: Only positive numbers are accepted