Problem 42404. Divisible by 2
how about function "rem"?
Thanks for the catch. I've added that function to the outlawed list for this and all subsequent problems in this set. Let me know if there are any other functions that should be added to that list.
FYI, I had commented my code with text that included the word "remains". This triggered a false positive in the test for forbidden function "rem". Perhaps it is possible to forbid instead "rem[spaces]("?
I suggest that "factor" should be (or should have been) banned.
I added factor to the banned list. [Though, the test suite includes very large numbers (as strings) that are beyond the storage limit of single- or double-precision variables.]
Also, that sort of string with wildcards (for capturing rem) would work if regexp were used, but I use strfind in the test suite. That way, only the direct use of those exact strings will trigger that test case to fail.
Many solutions can be made that only check 0, 2, and 6 and fail on 4 and 8, thus not checking properly. The tests should include more unique ending digits, at least one of each 0-9.
Your test cases only ever end in 0, 1, 2, 3, 6, and 7 and many solutions give the wrong answer on 4, 5, 8, or 9.
It shows me wrong.
Problem Recent Solvers513
Project Euler: Problem 10, Sum of Primes
More from this Author139
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!