Euler Problem 124


Euler Problem 124:Determining the kth element of the sorted radical function.

Implementacija u Mathematica:Obzirom da Mathematica posjedije fukciju za faktorizaciju, iskoristićemo je te formirati listu u kojoj svki element liste sadrži dva broja, n i proizvod njegovih različitih faktora (kako je zadatkom definisano). Listu sortiramo i prikažemo 10000 element liste.

n = 100000; nth = 10000;
Sort[Table[{n, Product[n, {n, FactorInteger[n][[All, 1]]}]}, 
{n, 1, n}], #1[[2]] <= #2[[2]] &][[nth, 1]]

About Bahrudin Hrnjica

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

Posted on 07/03/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