-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66f9365
commit 8c8f25d
Showing
5 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Python Implementation of Problem 63 | ||
=================================== | ||
|
||
View source code `here on GitHub! <https://github.com/LivInTheLookingGlass/Euler/blob/master/python/p0063.py>`_ | ||
|
||
Problem Solution | ||
---------------- | ||
|
||
.. automodule:: python.p0063 | ||
:members: | ||
:undoc-members: | ||
|
||
.. literalinclude:: ../../python/p0063.py | ||
:language: python | ||
:linenos: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Project Euler Problem 63 | ||
Problem: | ||
The 5-digit number, 16807 = 7**5, is also a fifth power. | ||
Similarly, the 9-digit number, 134217728 = 8**9, is a ninth power. | ||
How many n-digit positive integers exist which are also an nth power? | ||
""" | ||
from typing import Dict, Tuple | ||
|
||
|
||
def main() -> int: | ||
seen: Dict[Tuple[int, int], int] = {} | ||
for x in range(1, 10): | ||
for n in range(1, 100): | ||
if len(str(x**n)) == n: | ||
seen[x,n] = x**n | ||
return len(seen) | ||
|
||
|
||
if __name__ == '__main__': | ||
print(main()) # pragma: no cover |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ | |
59: 107359, | ||
60: 26033, | ||
67: 7273, | ||
63: 49, | ||
69: 510510, | ||
71: 428570, | ||
73: 7295372, | ||
|