Project Euler

Announcements of available shared folders

Project Euler

Postby oliver » Thu May 19, 2011 4:12 pm

Solutions for some Project Euler (http://projecteuler.net/index.php?section=problems) problems, in RPL+ and JavaScript.

If you have a solution to contribute, go to My Data | Project Euler | Sharing, set Visible to All to ON, and tap Upload, and add to this thread. Include any noteworthy details or remarks, as you see fit.

#1 Add all the natural numbers below one thousand that are multiples of 3 or 5.

#2 By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

#3 Find the largest prime factor of a composite number.
One-liner.

#5 What is the smallest number divisible by each of the numbers 1 to 20?
One-liner.

#6 What is the difference between the sum of the squares and the square of the sums?
One-liner.

#7 Find the 10001st prime.
One-liner.

#10 Calculate the sum of all the primes below two million.
One-liner.

#12 What is the value of the first triangle number to have over five hundred divisors?

#13 Find the first ten digits of the sum of one-hundred 50-digit numbers.
One-liner in GS/ME.

#14 Find the longest sequence using a starting number under one million.

#15 Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner?
One-liner.

#16 What is the sum of the digits of the number 2^1000?

#18 Find the maximum sum travelling from the top of the triangle to the base.

#20 Find the sum of digits in 100!

#24 What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
One-liner.

#25 What is the first term in the Fibonacci sequence to contain 1000 digits?

#29 How many distinct terms are in the sequence generated by a^b for 2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?

#48 Find the last ten digits of 1^1 + 2^2 + ... + 1000^1000.

#67 Using an efficient algorithm find the maximal sum in the triangle?
One-liner in GS/ME.

#97 Find the last ten digits of the non-Mersenne prime: 28433 × 2^7830457 + 1.
One-liner.

#179 Consecutive positive divisors

[EDIT: this list is now outdated, as many more solutions have been added.]
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

More solutions

Postby oliver » Thu May 26, 2011 4:34 am

More solutions have been developed for which code has not been published.
See the list at viewtopic.php?f=7&t=270
If you developed a solution, and only want to submit the solution number and run-time, please add to that list.
(If you're happy to submit and/or discuss your code, too, add to this thread.)
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Note on #304

Postby oliver » Thu May 26, 2011 4:38 am

#304, not posted here, as it's still accepting solution submissions, was hard.
There's no quick elegant solution. At least two substantial tricks are necessary to solve it at all.
I won't say what, but note that v.1.3.8 has a fibmod instruction. ;-)
The next release is going to have a segmented prime sieve, which is a 3rd trick to reduce the run-time (by, I'm hoping, almost 50%).
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

More Solutions

Postby oliver » Sun Jul 24, 2011 5:20 am

Another 20 or so solutions have been included in this folder.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Update: more solutions, improved solutions

Postby oliver » Wed Jan 04, 2012 6:09 pm

Released another batch of solutions.

Some of these use the latest MorphEngine features (combine, BREAK, immediate algebraic expressions, radical, vlcm, etc.) and the new data types in v1.4: BigFloat and ContinuedFraction.

A number of previous solutions have seen simplifications due to RPL+ and command improvements (split now running on BigInts, etc.).

The study guide at http://naivedesign.com/ND1/Project_Euler.html has been updated.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Updated to use new features

Postby oliver » Tue Jan 31, 2012 6:36 am

Updated a dozen or so solutions to use immediate algebraic expressions (an RPL+ language feature, new in v1.4) and a..b syntax to create vectors (new in v1.4.1).
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm


Return to Downloadable Folders / Shared Data

Who is online

Users browsing this forum: No registered users and 1 guest

cron