November 9th, 2012, 07:55 PM
Thanks for the divmod tip, but in this case it won't help, as I don't want to i/p unless p is a factor of i, in which case there won't be a remainder.
Originally Posted by b49P23TIvg
November 10th, 2012, 10:39 AM
Found a faster way of doing it.
Instead of creating strings and converting them to integers, I multiply the last integer to get the new:
for cnt in range (1,10):
Using the i=str('1'**n) solution takes about 12 minutes for 1 <= n <= 7:
New solution, taking the previous i and multiplying it with 10**(10**(n-1)) and adding i back 9 times is a lot faster, taking only about 3 minutes and 5 seconds:
07:53:01:65 - Start
08:05:00.80 - Finish
Modifying the new solution to div i with the prime factor found, as well as searching the primes reversed (high to low) is about the same, about 1 second faster than the previous:
08:39:47:89 - Start
08:42:52.49 - Finish
08:45:44.06 - Start
08:48:49.00 - Finish