Math Computing Challenge :D

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Math Computing Challenge :D

Re: Math Computing Challenge :D

Post by jeeswg » 18 Mar 2017, 23:31

Btw does anyone have the image for this:
http://kubli-verlag.com/challengesum.png

Re: Math Computing Challenge :D

Post by Alibaba » 18 Jun 2014, 13:22

Sure, what is the result you get?

Re: Math Computing Challenge :D

Post by nnnik » 18 Jun 2014, 06:19

Better now?

Re: Math Computing Challenge :D

Post by Alibaba » 18 Jun 2014, 05:28

Do you still get the same result?
i think this one should be more precisely, bu i just realized you are missing the most important point! of course i won't simply tell you ;) but look at the division. :D

Re: Math Computing Challenge :D

Post by nnnik » 18 Jun 2014, 04:20

Here is my code in a faster version:

Code: Select all

#include Maths.ahk    ;// https://github.com/aviaryan/autohotkey-scripts/blob/master/Functions/Maths.ahk
SetBatchlines,-1

s := 0
i := 0

while (rep<20)
{
	i := SM_Add(i, 1)
	olds:=s
	s:=SM_Add(s, SM_Divide(SM_fact(i), SM_Pow(SM_Add(i, 1),i), 300))
	if (olds=s)
		rep++
	else
		rep:=0
}

msgbox s=%s%
Clipboard := s
return

Re: Math Computing Challenge :D

Post by nnnik » 18 Jun 2014, 03:15

Yeah didn't see anything.

Re: Math Computing Challenge :D

Post by Alibaba » 18 Jun 2014, 03:13

Well, thought about checking each result for each single n? ;)

Re: Math Computing Challenge :D

Post by nnnik » 18 Jun 2014, 03:06

Well i'm pretty sure that mine is too because I don't check properly if it stays the same.
my result after 200 iterations also looks differently.

Re: Math Computing Challenge :D

Post by Alibaba » 18 Jun 2014, 03:04

Your result is slightly off of mine by approx. -0.01 but tbh i don't know why since i'm basically using the same technique as you.
But still, i'm sure yours is wrong, sorry. :D

Re: Math Computing Challenge :D

Post by nnnik » 18 Jun 2014, 02:39

0.86980432098765432098765432098765432098765432098765432098765432098765432098765432098765432098765432097
I am not sure though since it is difficult to tell if the nr. will still change or not.
This is my try:

Code: Select all

#include Maths.ahk    ;// https://github.com/aviaryan/autohotkey-scripts/blob/master/Functions/Maths.ahk
SetBatchlines,-1
s := 0
i:= 0

while (strlen(s)<100||(substr(olds,3,97)!=substr(s,3,97))||(substr(oldolds,3,97)!=substr(s,3,97))(substr(oldoldolds,3,97)!=substr(s,3,97)))
{
   i := SM_Add(i, 1)
   ;~ s += (SM_fact(i)/((i+1)**i))
   oldoldolds:=oldolds
   oldolds:=olds
   olds:=s
   s:=SM_Add(s, SM_Divide(SM_fact(i), SM_Pow(SM_Add(i, 1),i), 100))
}

msgbox s=%s%
Clipboard := s
return
It uses guest's code as a basis.

This is the result if you use 200 iterations:
0.87985386217525853348630614507096003881987340048928990482961766912229638666121421136175444468678831036107444534186281838788136229268292783649361640007316052957179562523544381769477304709

Re: Math Computing Challenge :D

Post by nnnik » 18 Jun 2014, 02:16

I see a problem in your code here:
(i+1)**i

Re: Math Computing Challenge :D

Post by guest3456 » 18 Jun 2014, 02:14

can't be fkd, someone smarter will solve it

Re: Math Computing Challenge :D

Post by Alibaba » 18 Jun 2014, 02:08

Well, you made a simple mistake. Avis Lib actually is a good choice, but think again, where large integers in the formula are going to appear and you'll notice something. ;)

Re: Math Computing Challenge :D

Post by guest3456 » 18 Jun 2014, 02:01

Just tried this for fun, seemed that ahk couldn't handle the large floats, so I had to use libraries. But for some reason I got a negative result. I tried with both Avi's scientific maths library as well as Lazslo's long integer library. Both produced the same answer, although Laszlo's computed it much quicker (prob due to MCode). Also, didn't matter whether or not I used the MP_Divide func, still got the same answer, although even slower.

Code: Select all

s = -207151913161435000000000000000000000000000000000000000000000000000000000000000000000000000000.000000

Code: Select all


#include Maths.ahk    ;// https://github.com/aviaryan/autohotkey-scripts/blob/master/Functions/Maths.ahk

s := 0.0

while (StrLen(s) < 100)
{
   i := A_Index
   s += (SM_fact(i)/((i+1)**i))
   ;s += SM_Divide(SM_fact(i), (i+1)**i, 99)
}

msgbox s=%s%
;Clipboard := s
return

Math Computing Challenge :D

Post by Alibaba » 18 Jun 2014, 01:31

I heard some of you guys like maths. :)
Thats why i'm here with a little challenge for you today. :D :geek:

Here is the mathematical problem:
Assume that we have a sum called "s" that equals:
Image
(n being every possible integer greater than zero)
Therefore, sum "s" should be an algebraic constant greater than zero.

Your challenge:
Are you able to compute the constant which sum "s" equals, precisely to 100 digits (hint: smartly rounded to 99 decimal places) only by the use of autohotkey?

If you do so, please show your code+result and how long it took to calculate.

Winner with the most efficient way gets glory, honor and 2 cookies. :!:

Top