MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number being input, input might be uint64 for large numbers, out must be double precision?

Thank you to Project Euler Problem 3

59 correct solutions
168 incorrect solutions

Last solution submitted on Feb 01, 2015

3 Comments

Tomasz
on 2 Feb 2012

You should pass the x values as a string. A double precision number cannot resolve all the digits that one needs to solve the test suite problems:
>> x = 321676750829977632;
>> x == x+1
ans =
1

@bmtran
on 2 Feb 2012

I agree that there is an issue with the last test suite problem. passing it as a uint64 would work too.

Franck Dernoncourt
on 2 Feb 2012

Yep I got "Error: Out of memory. Type HELP MEMORY for your options." :-)

2 Comments