update:
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.
Again thwarted!!
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.
import time
startt = time.time()
def funa(n):
—-global a,b,c
—-if n > b:
——–return n-c
—-else:
——–return funb(a+funb(a+funb(a+funb(a+n))))
def funb(n):
—-global a,b,c
—-if n%a ==0:
——–return ((((((b-n)/a) + 1)*3)+1)*(a-c))+b
—-else:
——–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
total=0
count=0
y=83284007
y=[7,4007,84007,284007,3284007,83284007,4083284007,64083284007, 864083284007,13284007,23284007,33284007,283284007,183284007,383284007,483284007]
x=1
while count —-#for n in xrange(b+1):
—-#print n, funb(n)
—-total+=funb(count)
—-count+=1
—-if count in y:
——–print str(total)[-9:],count
print total
endt = time.time()
print ‘nRuntime: %dm’ % int((endt-startt)/60), ‘%ds’ % int((endt-startt)%60)


















































![Recommend [midknightr_deleted]](http://s3.amazonaws.com/arkayne-media/img/badge/logo-recommend-badge-medium.png)
Hmm.. obviously I have to do some type of summation simplification so I don’t have to use the computer to brute force sum everything (which would take years). At least I figured out how to get rid of the recursion. My Biochemistry/Neuroscience background hasn’t had alot of use for simplifying summations. So I’ll have to find time to study up a bit before I can finish this one.