HAHA! Got it!
With some Mathematica help on solving summations. I managed to see the ‘easy’ pattern everyone talks about in the forum that gets unlocked upon solving it! Boy I really over did this one
(4 a^2 (2 + b) + a (b (9 + 5 b – 5 c) – 8 c) -
3 b (2 + b) c + (4 a – 3 c) (-2 + a – Mod[b, a]) Mod[b, a])/***
That’s my equation (simplified believe it or not). I took out a piece as to not give away the answer.
No recursion, no anything, executes immediately.
I’ve been practicing different programming languages by solving problems on this Project Euler site. A new problem just went up, so I thought I would show my stuff and be one of the first to answer it
Well, I figured out much of the clever stuff I think and actually solved to 9 -digits I swear! 365911736, by summing the ‘reduced’ crazy function up to b=083284007 the last 9 digits of 7^21…Actually I went to the last 11 digits to make sure 365911736 was staying steady.
But my answer’s wrong (or I wouldn’t be posting it here, because they don’t want people spoiling things). Everything checks out though? Weird, I’ll have to come back to it later with fresh eyes.
Here’s my crazy code, not cleaned up. I figured out how to get out of the overflowing recursion of the crazy function, but left in the original so you could see how things evolved.
startt = time.time()
—-if n > b:
—-if n%a ==0:
——–return ((((((b-n)/a) + 1)*3)+1)*(a-c))+b
——–return ((((((b-n)/a) + 1)*3)+1)*(a-c))+b – (a-(n%a))
**edit: Duh, was able to get rid of the if/else by changing the last part of the formula from (a-(n%a)) to ((b-n)%a)
a,b,c = 21**7,7**21,12**7
#a,b,c = 50,2000,40
while count —-#for n in xrange(b+1):
—-#print n, funb(n)
—-if count in y:
endt = time.time()
print ‘nRuntime: %dm’ % int((endt-startt)/60), ‘%ds’ % int((endt-startt)%60)