Skip to main content
replaced http://meta.codegolf.stackexchange.com/ with https://codegolf.meta.stackexchange.com/
Source Link
replaced http://meta.codegolf.stackexchange.com/ with https://codegolf.meta.stackexchange.com/
Source Link
replaced http://meta.codegolf.stackexchange.com/ with https://codegolf.meta.stackexchange.com/
Source Link

Retina, 160 + 7 = 167 bytes

;`.+
$$$$\varphi=1+\dots#$0$$$$

;+(\d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0) $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10# ;#

;+`\\d?dots\d(\d*)
\cfrac1{1+\ddots$1}

Each line goes into a separate source file, so I've added 1 byte for each file after the first1 byte for each file after the first. However, for convenience, Retina now also supports the -s command-line flag, which allows you to put all of this into a single file (in which case the newlines are treated as file separators).

The largest part of the code (98 bytes) is used to convert the input from decimal to unary (files 3 to 6). The basic idea of the code is to surround the input in $$\varphi=1+\dots...$$, then convert the input to unary, and then expand \dotsN or \ddotsN to the next level of the continued fraction (while reducing N to N-1).

Retina, 160 + 7 = 167 bytes

;`.+
$$$$\varphi=1+\dots#$0$$$$

;+(\d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0) $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10# ;#

;+`\\d?dots\d(\d*)
\cfrac1{1+\ddots$1}

Each line goes into a separate source file, so I've added 1 byte for each file after the first. However, for convenience, Retina now also supports the -s command-line flag, which allows you to put all of this into a single file (in which case the newlines are treated as file separators).

The largest part of the code (98 bytes) is used to convert the input from decimal to unary (files 3 to 6). The basic idea of the code is to surround the input in $$\varphi=1+\dots...$$, then convert the input to unary, and then expand \dotsN or \ddotsN to the next level of the continued fraction (while reducing N to N-1).

Retina, 160 + 7 = 167 bytes

;`.+
$$$$\varphi=1+\dots#$0$$$$

;+(\d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0) $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10# ;#

;+`\\d?dots\d(\d*)
\cfrac1{1+\ddots$1}

Each line goes into a separate source file, so I've added 1 byte for each file after the first. However, for convenience, Retina now also supports the -s command-line flag, which allows you to put all of this into a single file (in which case the newlines are treated as file separators).

The largest part of the code (98 bytes) is used to convert the input from decimal to unary (files 3 to 6). The basic idea of the code is to surround the input in $$\varphi=1+\dots...$$, then convert the input to unary, and then expand \dotsN or \ddotsN to the next level of the continued fraction (while reducing N to N-1).

Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975
Loading