Re: Coder speed challenge

Originally Posted by
PeejAvery
1234567 has a lot more prime numbers than you have for it. It should have...
1 3 5 7 23 67 4567
I guess that I am

by your problem. What do you mean by split every way possible? The following finds all prime numbers possible by combinations (not rearranging the characters) of the string.
...
Take another look at the problem and at the sample i/o
By 'split' I meant a pure geometrical split. Inserting spaces in the appropriate places if you like
1234567 can only be split in two ways
1 2 3 4567
and
1 23 4567
Any other way would either be not composed entirely of prime numbers or won't give the input number if you remove the spaces. Look at how 34 gives no output. It's because 34 is not prime and "3, 4" are not two prime numbers.
<edit> and what TheCPUWizard said in his reply
</edit>
Last edited by SeventhStar; April 10th, 2007 at 01:50 PM.
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames