Skip to main content
Minor editing
Source Link
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68

ActuallyActually, 38 37 35 33 31 30 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome. Try it online!

Edit: -3 bytes thanks to Leaky Nun.

2R#╗,;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E 

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ; Duplicate i 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n Run function (input) times D╜E Return (final list)[n-1] 

Actually, 38 37 35 33 31 30 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome. Try it online!

Edit: -3 bytes thanks to Leaky Nun.

2R#╗,;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E 

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ; Duplicate i 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n Run function (input) times D╜E Return (final list)[n-1] 

Actually, 38 37 35 33 31 30 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome. Try it online!

Edit: -3 bytes thanks to Leaky Nun.

2R#╗,;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E 

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ; Duplicate i 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n Run function (input) times D╜E Return (final list)[n-1] 
Minor editing
Source Link
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68

Actually, 38 37 35 33 31 30 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome. Try it online!

Edit: -3 bytes thanks to Leaky Nun.

2R#╗,;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E 

Try it online!

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ; Duplicate i 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n Run function (input) times D╜E Return (final list)[n-1] 

Actually, 38 37 35 33 31 30 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome.

Edit: -3 bytes thanks to Leaky Nun.

2R#╗,;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E 

Try it online!

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ; Duplicate i 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n Run function (input) times D╜E Return (final list)[n-1] 

Actually, 38 37 35 33 31 30 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome. Try it online!

Edit: -3 bytes thanks to Leaky Nun.

2R#╗,;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E 

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ; Duplicate i 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n Run function (input) times D╜E Return (final list)[n-1] 
More golfing
Source Link
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68

Actually, 38 37 35 33 3131 30 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome.

Edit: -23 bytes thanks to Leaky Nun.

2R#╗,;`1";;2±╜tπg@╜í+Y"£╓╖`nD╜E;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E 

Try it online!

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ;;;  Duplicate i twice 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n runRun function (input) times D╜E takeReturn (final list )[n-1] and return 

Actually, 38 37 35 33 31 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome.

Edit: -2 bytes thanks to Leaky Nun.

2R#╗,;`1";;2±╜tπg@╜í+Y"£╓╖`nD╜E 

Try it online!

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ;; Duplicate i twice 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n run function (input) times D╜E take final list [n-1] and return 

Actually, 38 37 35 33 31 30 bytes

This is a simple implementation of the function definition. Golfing suggestions welcome.

Edit: -3 bytes thanks to Leaky Nun.

2R#╗,;`1";2±╜tπg@╜í+Y"£╓╖`nD╜E 

Try it online!

Ungolfing:

2R#╗ Push [1,2] and store it in register 0 ,; Take input and duplicate `1 Start function, push 1 " Start string ;  Duplicate i 2±╜t Push (list in register 0)[-2:] πg gcd(i, product of list[-2:]) @╜í Rotate the gcd and bring up i, check for i in list (0-based, -1 if not found) +Y Add the gcd and the index, negate (1 if coprime and not found in list, else 0) "£ End string, turn into a function ╓ Push first (1) values where f(x) is truthy, starting with f(0) ╖` Append result to the list in register 0, end function n Run function (input) times D╜E Return (final list)[n-1] 
More golfing
Source Link
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68
Loading
More golfing
Source Link
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68
Loading
More golfing
Source Link
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68
Loading
added 120 characters in body
Source Link
Leaky Nun
  • 50.6k
  • 6
  • 115
  • 291
Loading
More golfing
Source Link
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68
Loading
Source Link
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68
Loading