Yellowstone sequence: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Include the actual terminal output too.) |
(→{{header|Go}}: Fixed bug though results unaffected.) |
||
Line 103: | Line 103: | ||
m[i] = true |
m[i] = true |
||
} |
} |
||
min := |
min := 4 |
||
for c := 4; c <= n; c++ { |
for c := 4; c <= n; c++ { |
||
for i := min |
for i := min; ; i++ { |
||
if !m[i] && gcd(a[c-1], i) == 1 && gcd(a[c-2], i) > 1 { |
if !m[i] && gcd(a[c-1], i) == 1 && gcd(a[c-2], i) > 1 { |
||
a[c] = i |
a[c] = i |
||
m[i] = true |
m[i] = true |
||
if i |
if i == min { |
||
min |
min++ |
||
} |
} |
||
break |
break |
||
} |
} |
||
} |
} |
||
} |
} |
||
return a[1:] |
return a[1:] |
||
} |
} |