Problem 42936. Project Euler: Problem 11, Largest product in a grid
Since I can't tell from the test suite, do you wrap around the matrix when you are calculating the products? For example, when doing the products of four consecutive numbers in the up/down direction, do you do rows 1:4, 2:5, 3:6, 4:7...7:10 and stop there, or do you include the row combinations [8:10 1], [9:10 1:2] and [10 1:3]?
Just submitted my solution (slightly modified from the original Project Euler problem! :-), and the values do not wrap around in any direction.
I vaguely remember there was an earlier problem exactly the same as this one on Cody, and I solved that problem some time ago. But couldn't find the old problem....
All diagonals and reverse diagonals must be tested if you are wondering as I were once.
Today I learned that randi is not actually random on the Cody servers at least.
Also, screw off with this obfuscating the answers crap. It doesn't help anyone. Hacked your code. Got first place. Didn't actually do the problem.
The sums are 67369440, 1168976793600, and 212260240281600.
@Brandon randi is deterministic, and returns pseudorandom numbers rather than true random numbers. Additionally, the default seed with which the PRNG is initialized is the same across MATLAB sessions (see doc rng); this is on purpose and for a reason, namely reproducibility. If this is unhelpful in a given application, you can use rng shuffle.
I agree that the obfuscation of the correct answers is not really helpful.
Solution CommentsShow comments
Problem Recent Solvers73
Number of 1s in the Binary Representation of a Number
Project Euler: Problem 9, Pythagorean numbers
Return a list sorted by number of consecutive occurrences
More from this Author2
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!