1 | initial version |
This seems more like a homework question than something about Sage. Sage won't be able to give you a formula for the number of zero divisors of Z mod (pqr) (although one exists); you need some more theoretical knowledge for that. However, here is a naive function which counts the number of zero divisors of Z mod n:
def number_of_zero_divisors(n):
zero_divisors = 0
for i in range(1, n):
for j in range(1, n):
if (i*j) % n == 0:
zero_divisors += 1
break
return zero_divisors
Here is some sample output:
sage: number_of_zero_divisors(2*3*5)
21
sage: number_of_zero_divisors(5*7*11)
144