Added solution for Project Euler problem 119#2931
Merged
dhruvmanila merged 1 commit intoTheAlgorithms:masterfrom Oct 10, 2020
Merged
Added solution for Project Euler problem 119#2931dhruvmanila merged 1 commit intoTheAlgorithms:masterfrom
dhruvmanila merged 1 commit intoTheAlgorithms:masterfrom
Conversation
33eb596 to
e03214f
Compare
c8f232f to
77d2401
Compare
dhruvmanila
requested changes
Oct 10, 2020
Comment on lines
+12
to
+13
|
|
||
|
|
Contributor
Author
There was a problem hiding this comment.
removed the empty line.
Member
There was a problem hiding this comment.
Remove both the newlines before the imports :)
You could've directly applied the suggestion but it's up to you.
|
|
||
| def solution() -> int: | ||
| """ | ||
| Returns the value of a30 |
Member
There was a problem hiding this comment.
Please improve on docstring and add doctest
Contributor
Author
There was a problem hiding this comment.
updated docstring and added doctests
| powers = [] | ||
| for i in range(2, 100): | ||
| for j in range(2, 100): | ||
| n = int(math.pow(i, j)) |
Member
There was a problem hiding this comment.
Can we have a more descriptive variable name than n?
dhruvmanila
reviewed
Oct 10, 2020
Comment on lines
+39
to
+42
| digi_to_powers = [] | ||
| for digit in range(2, 100): | ||
| for power in range(2, 100): | ||
| digit_to_power = int(math.pow(digit, power)) |
Member
There was a problem hiding this comment.
Maybe number instead of digit_to_power and digit_to_powers instead of digi_to_powers ?
Contributor
Author
There was a problem hiding this comment.
oops, sorry for the typo. Fixed it.
Name: Digit power sum Problem Statement: The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284. We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum. You are given that a2 = 512 and a10 = 614656. Find a30 Reference: https://projecteuler.net/problem=119 reference: TheAlgorithms#2695
dhruvmanila
approved these changes
Oct 10, 2020
stokhos
pushed a commit
to stokhos/Python
that referenced
this pull request
Jan 3, 2021
Name: Digit power sum Problem Statement: The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284. We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum. You are given that a2 = 512 and a10 = 614656. Find a30 Reference: https://projecteuler.net/problem=119 reference: TheAlgorithms#2695 Co-authored-by: Ravi Kandasamy Sundaram <rkandasamysundaram@luxoft.com>
Panquesito7
pushed a commit
to Panquesito7/Python
that referenced
this pull request
May 13, 2021
Name: Digit power sum Problem Statement: The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284. We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum. You are given that a2 = 512 and a10 = 614656. Find a30 Reference: https://projecteuler.net/problem=119 reference: TheAlgorithms#2695 Co-authored-by: Ravi Kandasamy Sundaram <rkandasamysundaram@luxoft.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Name: Digit power sum
Problem Statement: The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284.
We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum.
You are given that a2 = 512 and a10 = 614656.
Find a30
Reference: https://projecteuler.net/problem=119
reference: #2695
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.