Snake Arithmetic

Besere
Posts: 12
Joined: Sat Mar 12, 2011 12:58 pm

Post by Besere »

I got 37xxxxxxxxx54 but it is incorrect. Any hints on what I might have did wrong?
honze
Posts: 6
Joined: Mon Nov 03, 2008 7:20 am
Location: Munich, Germany
Contact:

Post by honze »

I used several implementations in different languages to calculate and compare.
The good thing: I get consistent results with small error rates. (Java same result as Python)
The bad thing: The last three digits are varying.

At some point (~85000000 iterations) the value of the answer does not change anymore.
I get there quite fast.

How do I check, whether my sum is "correct"?

I could bruteforce the last three digits, but that is #%&$§.
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

For those who don´t like guessing ... the correct answer is smaller by one than the answer the challenge accepts.
meis
Posts: 16
Joined: Tue Aug 28, 2012 5:22 pm
Location: Italy

Post by meis »

I transformed D(n) in something not-recursive. Am I on the right path? Can I do the same with N(n)? I can't find a pattern...
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

meis wrote:I transformed D(n) in something not-recursive. Am I on the right path? Can I do the same with N(n)? I can't find a pattern...
My path ... used just pen and paper.
5el
Posts: 4
Joined: Wed Jul 18, 2012 12:28 pm

Post by 5el »

Hippo wrote:For those who don´t like guessing ... the correct answer is smaller by one than the answer the challenge accepts.
If I round my result correctly I'm getting exactly the result accepted by the challenge.
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

5el wrote:
Hippo wrote:For those who don´t like guessing ... the correct answer is smaller by one than the answer the challenge accepts.
If I round my result correctly I'm getting exactly the result accepted by the challenge.
Yes, my fault, the challenge is OK.
peterisp
Posts: 1
Joined: Sun Dec 11, 2016 6:36 pm

Post by peterisp »

I'm a bit confused here. I have an analytic solution to what exactly N(x)/D(x) converges at infinity (starting with 0.7), which matches what I get if I run an optimized version of the code up to some 100000 iterations. At 1000000000000 iterations it should be converged to all the required significant digits - but still if I calculate that number and multiply by 1000000000000, it's not getting accepted as a correct answer, including some +- values that might be (but shouldn't be) affected by rounding.

Am I missing something here?
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

I did it the way you describe. So recheck the reasoning for the formula and as well the transformation to the answer ... number of digits used ... .
meis
Posts: 16
Joined: Tue Aug 28, 2012 5:22 pm
Location: Italy

Post by meis »

Alright, before I go on with my comment here, it's best I do a little prologue.
This challenge is my nemesis.
I love math, always have, and I started tackling this challenge for the first time when I was around 16/17 years old (more or less when I created my account here). From there on I started doing challenges occasionally, and every 1 or 2 years I come back here, to see if I have improved in some sense (usually I manage to do 2/3 challenges each time). Every time I try to do this one, and every time I come closer and closer, without actually managing to.
It angers me, because I KNOW it's easy, I KNOW the solution is before my eyes, but I cannot see it.

This time, after almost ten years from the first time I tackled this (and around 30/40 hours of fiddling with numbers and formulas), I give up. And by give up, I mean that I ask for some tips on this forum.

I managed to come up with a decent formula for N(x)/D(x), but it still is recursive. I translated it into a series, hoping I didn't do any math error along the way.

Now since this series still loops x/2 times, I need to unravel it. It seems the last step but really, I can't find the way to do it.

I'm not sayinmg too much to not spoil for others, but how can I do this last step? Should it be obvious? Have I made a mistake in rewriting the formula into a series? (although the result seems to work correctly for me for low numbers)
tehron
Posts: 7
Joined: Tue Jun 30, 2009 8:31 pm

Post by tehron »

Let me just say: I feel with you.

Hope we will solve it soon! :)
Post Reply