Ifwe list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.
sum =0 for i in 1...1000 do if (i%3==0 or i%5==0) sum += i end end puts sum
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number?
require mathn counter =0 last = nil Prime.each(100000000000) do |i| counter += 1 last = i break if counter==10001 end print last
Watch this http://net.tutsplus.com/sessions/ruby-for- newbies/ Solve this : http://projecteuler.net/problem=2 http://projecteuler.net/problem=13
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 371072875339021027987979982208375902465 10135740250 463…………….124896970078050417018260538 743249861995247410594742333095130581237 26617309629