Turtle Posted October 12, 2015 Author Report Posted October 12, 2015 okay got it. much faster code, I'm now down to 1,000,000 every 3 seconds. Dance it Alien; dance it goood! Quote
phillip1882 Posted October 12, 2015 Report Posted October 12, 2015 (edited) i'm so proud of my code i think i'll post it here. def total(A,n): v = 1 total = 1 t = 1 for i in range(0,len(A)-1): if A[i] == A[i+1]: v*=A[i] t += v else: v*=A[i] t += v total *= t v = 1 t = 1 v*=A[-1] t += v total *= t total -= n return total primes = [False,False,True,True]+[False,True,False,True,False,False]*16667 n = 5 while n*n < len(primes): x = len(primes)/n while x > 1: if primes[x]: primes[x*n] = False x -= 1 n += 1 while not primes[n]: n += 1 t = 2000000001 for i in range(0,10000): factor = [1]*1000000 j = 2 while j < len(primes): v = t%j k = t-v+j while k < t+1000000: s = k if factor[k-t] == 1: factor[k-t] = [j] s /= j while s%j == 0: factor[k-t] += [j] s /= j k += j j += 1 while j < len(primes) and not primes[j]: j += 1 for j in range(0,1000000): if factor[j] != 1: if j +t == 18: print factor[j] r = total(factor[j],j+t) if r == j+t+3: print r t += 1000000 print t Edited October 12, 2015 by phillip1882 Quote
phillip1882 Posted October 13, 2015 Report Posted October 13, 2015 (edited) ah poo, just realized there's a big ol' flaw in my code. i knew it was too good to be true. let me rehash it.edit: fixed. def total(A,n): v = 1 total = 1 t = 1 for i in range(0,len(A)-1): if A[i] == A[i+1]: v*=A[i] t += v else: v*=A[i] t += v total *= t v = 1 t = 1 v*=A[-1] t += v total *= t total -= n return total primes = [False,False,True,True]+[False,True,False,True,False,False]*16667 n = 5 while n*n < len(primes): x = len(primes)/n while x > 1: if primes[x]: primes[x*n] = False x -= 1 n += 1 while not primes[n]: n += 1 t = 2000000001 for i in range(0,10000): factor = [1]*1000000 j = 2 while j < len(primes): v = t%j k = t-v+j while k < t+1000000: s = k if factor[k-t] == 1: factor[k-t] = [j] s /= j while s%j == 0: factor[k-t] += [j] s /= j k += j j += 1 while j < len(primes) and not primes[j]: j += 1 for j in range(0,1000000): if factor[j] != 1: m = j+t for q in range(0,len(factor[j])): m /= factor[j][q] if m != 1: factor[j] += [m] if j +t == 2500000020: print factor[j] r = total(factor[j],j+t) if r == j+t+3: print r t += 1000000 print t Edited October 13, 2015 by phillip1882 Quote
phillip1882 Posted October 13, 2015 Report Posted October 13, 2015 hit 5 billion!! should be at 10 by the end of today. Quote
phillip1882 Posted October 13, 2015 Report Posted October 13, 2015 (edited) 7 billionedit:alright turtle, 10 billion, and no luck. i;m calling it there. Edited October 14, 2015 by phillip1882 Quote
Turtle Posted October 15, 2015 Author Report Posted October 15, 2015 7 billion edit: alright turtle, 10 billion, and no luck. i;m calling it there.OK. Good effort. Conjecture: 18 is the only natural number abundant by 3. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.