This commit is contained in:
2023-09-20 09:53:04 -04:00
parent bc46c80b02
commit f8006eb17c
10 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,14 @@
WTF - Write Totatives Finder
=================
The divisors of a number are those numbers that divide it evenly; for example, the divisors of 60 are `1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, and 60`. The sum of the divisors of 60 is 168, and the number of divisors of 60 is 12.
The totatives of a number are those numbers less than the given number and coprime to it. Two numbers are coprime if they have no common factors other than 1.
For example, the totatives of 30 are `1, 7, 11, 13, 17, 19, 23, and 29`.
The number of totatives of a given number is called its totient. As you can see above, the totient of 30 is 8.
Your task is to write a small library of five functions that compute the divisors of a number, the sum and number of its divisors, the totatives of a number, and its totient.
_Hint_: The functions can call each other!

14
05-sum_of_divisors/wtf.py Normal file
View File

@ -0,0 +1,14 @@
def compute_divisors(num):
pass
def sum_of_divisors(num):
pass
def divisor_count(num):
pass
def get_totatives(num):
pass
def totient(num):
pass