Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Yellowstone-sequence/J/yellowstone-sequence-1.j
Normal file
11
Task/Yellowstone-sequence/J/yellowstone-sequence-1.j
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Until=: 2 :'u^:(0-:v)^:_'
|
||||
assert 44 -: >:Until(>&43) 32 NB. increment until exceeding 43
|
||||
gcd=: +.
|
||||
coprime=: 1 = gcd
|
||||
prepare=:1 2 3"_ NB. start with the vector 1 2 3
|
||||
condition=: 0 1 -: (coprime _2&{.) NB. trial coprime most recent 2, nay and yay
|
||||
append=: , NB. concatenate
|
||||
novel=: -.@e. NB. x is not a member of y
|
||||
term=: >:@:]Until((condition *. novel)~) 4:
|
||||
ys=: (append term)@]^:(0 >. _3+[) prepare
|
||||
assert (ys 30) -: 1 2 3 4 9 8 15 14 5 6 25 12 35 16 7 10 21 20 27 22 39 11 13 33 26 45 28 51 32 17
|
||||
13
Task/Yellowstone-sequence/J/yellowstone-sequence-2.j
Normal file
13
Task/Yellowstone-sequence/J/yellowstone-sequence-2.j
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
GCD=: +.
|
||||
relatively_prime=: 1 = GCD
|
||||
|
||||
yellowstone=: {{
|
||||
s=. 1 2 3 NB. initial sequence
|
||||
while. y > # s do.
|
||||
z=. <./(1+s)-.s NB. lowest positive inteeger not in sequence
|
||||
while. if. 0 1 -: z relatively_prime _2{.s do. z e. s end. do.
|
||||
z=. z+1
|
||||
end. NB. find next value for sequence
|
||||
s=. s, z
|
||||
end.
|
||||
}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue