Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small bug on Euler Problem 88, line 69 #2

Closed
arthurdepina opened this issue Jan 22, 2024 · 1 comment
Closed

small bug on Euler Problem 88, line 69 #2

arthurdepina opened this issue Jan 22, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@arthurdepina
Copy link

Hey! Really liked your solution and thank you for the great explanation, I was having a hard time with this problem.
Anyway, I noticed a (very) small problem on your code for problem 88. It's pretty much meaningless, but you might want to fix it either way.

You'll notice that if you run your code for 2 <= k <= 6, compute(6) will return 18, when it should return 30. The problem is on line 69: array = array[2:limit].
The array is being cut too short and will not include the minimal product-sum for k = 6. If we print the array on line 69, we have [4, 6, 8, 8].
Changing the line to array = array[2:limit + 1]: [4, 6, 8, 8, 12].

I wonder if it's not a problem for any k > 6. It sure isn't for 12000.
Again thanks for your solution and explanation.

@igorvanloo
Copy link
Owner

Hey!

I'm really glad you liked my solution and that you pointed out this error to me, I have updated it.

Interestingly, you get the same answer for a few values of k near 12,000. This must've been one of the rare times I wrote up the code, clicked run and the submitted answer happened to be correct on the first try and I didn't check further.

Thanks again for comment!

@igorvanloo igorvanloo self-assigned this Jan 22, 2024
@igorvanloo igorvanloo added the bug Something isn't working label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants