Problem 8
Ruby
1data = ''
2f = File.open("problem8.txt", "r")
3 f.each_line do |line|
4 data += line
5 end
6nums = data.chars
7nums = nums.map(&:to_i);
8max = 13;
9min = 0;
10orig_min = 0;
11max_prod = 0;
12while max < nums.length
13 min = orig_min
14 temp_prod = 1;
15 while min != max
16 temp_prod *= nums[min]
17 min+=1
18 end
19 if temp_prod > max_prod
20 max_prod = temp_prod
21 end
22 orig_min+=1
23 max+=1
24end
25puts"#{max_prod}"
Perl 6
1say max slurp.comb.rotor( 13 => -12 ).map( { [*] $_ } );