aboutsummaryrefslogtreecommitdiff
path: root/challenge-089/ash/ruby/ch-1.rb
blob: 19b9d813fca0a521ef89b369dc16899547b3b709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Usage:
# $ ruby ch-1.rb 100
# 13015

n = ARGV.length == 1 ? ARGV[0].to_i : 3

s = 0
for x in 1 .. n
    for y in x + 1 .. n
        s += x.gcd(y)
    end
end

puts s