View Single Post
Old 2008-04-27, 17:12   #9
Just call me Henry
henryzz's Avatar
Sep 2007
Cambridge (GMT/BST)

2×2,909 Posts

Originally Posted by petrw1 View Post
I would consider saving in an array all numbers (prime or otherwise) encountered so far. Whenever your current chain matches one of those you can skip to the next chain knowing it will eventually end in 3.

I suspect that most will abort a lot sooner.

I believe the astutue programmers call this memoization.
i have programed this
unfortunatly it only takes off a fifth of the time
are there any more suggestion?
henryzz is online now   Reply With Quote