Last active
December 15, 2019 18:50
-
-
Save hanksims/9f1f16c1aaae6194ad6dc8df27ce8e03 to your computer and use it in GitHub Desktop.
Prisms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [112]: def find_prisms(): | |
...: found = set() | |
...: for a in range(1,10000): | |
...: for b in range(1,10000): | |
...: numerator = 2*a*b | |
...: denominator = a*b - 2*a - 2*b | |
...: if denominator > 0: | |
...: c = numerator/denominator | |
...: if c.is_integer(): | |
...: found.add(tuple(sorted((a,b,int(c))))) | |
...: return found | |
...: | |
...: | |
...: | |
...: | |
...: | |
In [113]: a = find_prisms() | |
In [114]: print(a) | |
{(3, 8, 24), (3, 9, 18), (4, 8, 8), (4, 6, 12), (6, 6, 6), (3, 12, 12), (3, 10, 15), (3, 7, 42), (4, 5, 20), (5, 5, 10)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment