Euler Problem 277


Euler Problem 277:

Rješenje pomoću Wolfram Mathematica. Interesantno je to da FindInstance ne pronalazi (bar kod mene) prvo minimalno rješenje, nego kad se potraži prvih 5 rješenja, onda će se naći i traženo. )

a1 = n;(*first*)
a2 = (4 a1 + 2)/3;(*U*)
a3 = a2/3;(*D*)
a4 = a3/3;(*D*)
a5 = a4/3;(*D*)
a6 = (4 a5 + 2)/3;(*U*)
a7 = (2 a6 - 1)/3;(*d*)
a8 = (2 a7 - 1)/3;(*d*)
a9 = (2 a8 - 1)/3;(*d*)
a10 = a9/3;(*D*)
a11 = a10/3;(*D*)
a12 = (4 a11 + 2)/3;(*U*)
a13 = a12/3;(*D*)
a14 = a13/3;(*D*)
a15 = (2 a14 - 1)/3;(*d*)
a16 = (2 a15 - 1)/3;(*d*)
a17 = a16/3;(*D*)
a18 = (2 a17 - 1)/3;(*d*)
a19 = a18/3;(*D*)
a20 = (2 a19 - 1)/3;(*d*)
a21 = (2 a20 - 1)/3;(*d*)
a22 = a21/3;(*D*)
a23 = a22/3;(*D*)
a24 = (4 a23 + 2)/3;(*U*)
a25 = a24/3;(*D*)
a26 = a25/3;(*D*)
a27 = (2 a26 - 1)/3;(*d*)
a28 = (4 a27 + 2)/3;(*U*)
a29 = (4 a28 + 2)/3;(*U*)
a30 = a29/3;(*D*)
a31 = (2 a30 - 1)/3;(*d*)
Timing[FindInstance[a31 == k && n > 10^15, {n, k}, Integers, 5]]

About Bahrudin Hrnjica

PhD in Mechanical Engineering, Microsoft MVP for .NET. Likes .NET, Math, Mechanical Engineering, Evolutionary Algorithms, Blogging.

Posted on 16/04/2010, in Project Euler and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s