Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Yellowstone-sequence/Ruby/yellowstone-sequence.rb
Normal file
16
Task/Yellowstone-sequence/Ruby/yellowstone-sequence.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
def yellow(n)
|
||||
a = [1, 2, 3]
|
||||
b = { 1 => true, 2 => true, 3 => true }
|
||||
i = 4
|
||||
while n > a.length
|
||||
if !b[i] && i.gcd(a[-1]) == 1 && i.gcd(a[-2]) > 1
|
||||
a << i
|
||||
b[i] = true
|
||||
i = 4
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
a
|
||||
end
|
||||
|
||||
p yellow(30)
|
||||
Loading…
Add table
Add a link
Reference in a new issue