Largest palindrome product: Difference between revisions
→{{header|Go}}: Optimized as per Wren - cuts run time in half.
(→{{header|Wren}}: Optimized inner loop - run time now less than 0.7 seconds.) |
(→{{header|Go}}: Optimized as per Wren - cuts run time in half.) |
||
Line 19:
=={{header|Go}}==
{{trans|Wren}}
18 digit integers are within the range of Go's uint64 type though finding the result for 9-digit number products takes a while - around
<lang go>package main
Line 44:
j := reverse(i)
p := i*pow + j
//
if p%11 != 0 || p%10 != 9 {▼
continue
}
for k := high; k > low; k -= 2 {
continue
}
l := p / k
if l > high {
|