Skip to main content
deleted 101 characters in body; added 1 character in body
Source Link
Unrelated String
  • 23.9k
  • 3
  • 37
  • 61

Brachylog, 1616 14 bytes

0|0;1⟨t≡+⟩ⁱhℕ↙1;0⟨t≡+⟩ⁱhℕ↙.! 

Try it online!Try it online!

Takes input through the output variable and outputs through success or failure, and in the case of success the input variable is unified with 01.

0| The output variable is 0, or 0;11;0 startingStarting with [0[1,1]0],   ⁱ iterating   ⟨ ≡ ⟩ replacing   ⟨t ⟩ the first element of the pair with the last element   ⟨ +⟩ and the last element with the sum of the pair   h until the first element   ℕ↙ is greater than or equal to   . the output variable,   ! and stopping then,   h the first element of the pair is equal to the output variable. 

ℕ↙.! is necessary for it to terminate on false test cases, and 0| is necessary for it to succeed with an input of 0.

Brachylog, 16 bytes

0|0;1⟨t≡+⟩ⁱhℕ↙.! 

Try it online!

Takes input through the output variable and outputs through success or failure, and in the case of success the input variable is unified with 0.

0| The output variable is 0, or 0;1 starting with [0,1]   ⁱ iterating   ⟨ ≡ ⟩ replacing   ⟨t ⟩ the first element of the pair with the last element   ⟨ +⟩ and the last element with the sum of the pair   h until the first element   ℕ↙ is greater than or equal to   . the output variable,   ! and stopping then,   h the first element of the pair is equal to the output variable. 

ℕ↙.! is necessary for it to terminate on false test cases, and 0| is necessary for it to succeed with an input of 0.

Brachylog, 16 14 bytes

1;0⟨t≡+⟩ⁱhℕ↙.! 

Try it online!

Takes input through the output variable and outputs through success or failure, and in the case of success the input variable is unified with 1.

1;0 Starting with [1,0], ⁱ iterating ⟨ ≡ ⟩ replacing ⟨t ⟩ the first element of the pair with the last element ⟨ +⟩ and the last element with the sum of the pair h until the first element ℕ↙ is greater than or equal to . the output variable, ! and stopping then, h the first element of the pair is equal to the output variable. 

ℕ↙.! is necessary for it to terminate on false test cases.

Source Link
Unrelated String
  • 23.9k
  • 3
  • 37
  • 61

Brachylog, 16 bytes

0|0;1⟨t≡+⟩ⁱhℕ↙.! 

Try it online!

Takes input through the output variable and outputs through success or failure, and in the case of success the input variable is unified with 0.

0| The output variable is 0, or 0;1 starting with [0,1] ⁱ iterating ⟨ ≡ ⟩ replacing ⟨t ⟩ the first element of the pair with the last element ⟨ +⟩ and the last element with the sum of the pair h until the first element ℕ↙ is greater than or equal to . the output variable, ! and stopping then, h the first element of the pair is equal to the output variable. 

ℕ↙.! is necessary for it to terminate on false test cases, and 0| is necessary for it to succeed with an input of 0.