Hacker News new | ask | show | jobs
by milansuk 1508 days ago
I wrote it in C with just one loop: for(i=0; i <= 10000; i+=37) and one condition: if(i > 0 && i%13==0 && i%19==0) and it takes only 0.000003 sec.
2 comments

I was referring to the beer/meat/bread problem, but yeah. Brute force is ruthlessly effective for small problems.
if all the inputs are constants and don't depend on program input, it'd be interesting to disassemble that to see if the compiler solved the problem at compile time and generated a "load <constant_precomputed_solution>"

you may not necessarily be timing what you think you are timing