-
2 Comments
I know this solution has a higher Cody score than my previous, but it only takes one line of 75 characters (excluding endline), and I couldn't resist. This problem is THAT simple. It uses only five variables - including inputs and outputs, and all are scalars -- and nothing language specific besides how functions and for loops are defined and mod(), which essentially all languages define or at least support. And, of course, a couple of theorems.
No strings, str2num,regex, or any other tricks to make it seem simpler than it is! See the previous solution for a few comments that help a bit identifying the theorems.
That’s why it’s called “Easy…”
Suggested Problems
-
4513 Solvers
-
Diophantine Equations (Inspired by Project Euler, problem 66)
65 Solvers
-
Splitting Hexagon - Problem the third
31 Solvers
-
Easy Sequences 25: Product of Series
16 Solvers
-
102 Solvers
More from this Author116
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!