There's more than one way to do things | |
PerlMonks |
Re: Recamán's sequence and memory usageby anonymized user 468275 (Curate) |
on Jul 14, 2015 at 18:25 UTC ( [id://1134776]=note: print w/replies, xml ) | Need Help?? |
potential optimisations: 1) remove consecutive entries between a(0)=0 and m-1 where m is the first missing value. This prevents the sieve from growing beyond resources to support it. 2) use an array instead of a hash -- if the index is numeric, it's an array. 3) calculate the rate of growth of the remaining sieve to test for convergence. One world, one people
In Section
Meditations
|
|