Problem 246. Project Euler: Problem 8, Find largest product in a large string of numbers
Find the greatest product of five consecutive digits in an n-digit number.
7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843 8586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557 6689664895044524452316173185640309871112172238311362229893423380308135336276614282806444486645238749 3035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776 6572733300105336788122023542180975125454059475224352584907711670556013604839586446706324415722155397 5369781797784617406495514929086256932197846862248283972241375657056057490261407972968652414535100474 8216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586 1786645835912456652947654568284891288314260769004224219022671055626321111109370544217506941658960408 0719840385096245544436298123098787992724428490918884580156166097919133875499200524063689912560717606 0588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450
The large number will be given as a string, 1xn characters.
Thank you to Project Euler Problem 8
Solution Stats
Problem Comments
-
4 Comments
your problem need the result is: 'The large number will be given as a string, 1xn characters.', but your test suits given is double
hi i have a problem with the fact that how to convert this series into columns of a matrix in double without changing the arrangement ?
any advise on this would much appreciated thankyou
The problem isn't clear. I thought I was looking for the location of the largest of one of string(prod(0:4), prod(1:5), .. prod(5:9)) in the text. But the answers are way larger than either these numbers, or the length of the string.
A lot of solutions fail on a='1111109999'. Be sure to include "Endpoints","discard" when using movprod().
Solution Comments
Show commentsProblem Recent Solvers1100
Suggested Problems
-
3837 Solvers
-
Omit columns averages from a matrix
586 Solvers
-
Simple equation: Annual salary
4183 Solvers
-
967 Solvers
-
1157 Solvers
More from this Author51
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!