Skip to main content
removed LaTeX in preparation of disabling MathJax
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+"ri:R*'\      "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$

$$\varphi=1+\dots$$

N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$

N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!

Try it online here

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+"ri:R*'\      "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$


N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$


N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!

Try it online here

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+"ri:R*'\      "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$

N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$

N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!

Try it online here

edited body
Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+\\"ri:R*'\    "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+"ri:R*'\      "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$


N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$


N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!

Try it online here

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+\\"ri:R*'\    "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$


N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$


N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!

Try it online here

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+"ri:R*'\      "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$


N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$


N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!

Try it online here

Rollback to Revision 3
Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+\\"ri:R*'\    "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$


N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$


N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!


#Pyth, 49 bytes

Here is a direct translation of the above code in Pyth, where it saves 1 byte:

s("$$\varphi=1+"*"\cfrac1{1+"Q\\>"ddots"!Q*Q\}"$$

Try it online here

Try it online here

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+\\"ri:R*'\    "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$


N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$


N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!


#Pyth, 49 bytes

Here is a direct translation of the above code in Pyth, where it saves 1 byte:

s("$$\varphi=1+"*"\cfrac1{1+"Q\\>"ddots"!Q*Q\}"$$

Try it online here

Try it online here

#CJam, 51 50 bytes

$$\varphi=1+""\cfrac1{1+"ri:R*'\"ddots"R!>'}R*'$_

Code explanation:

"$$\varphi=1+"             "This is a static string";
  "\cfrac1{1+\\"ri:R*'\    "Repeat this string input number times. Put a \ at the end";
"ddots"R!>             "If input is 0, remove 1st characters, else not";
  '}R*                 "Put the closing bracket R times";
    '$_                "The final $$";

Few examples:

N = 0

$$\varphi=1+\dots$$


N = 4

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}$$


N = 15

$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}}}}}}}}}}}}}$$

UPDATE - 1 byte saved thanks to Sp3000!

Try it online here

added 342 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142
Loading
added 66 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142
Loading
added 339 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142
Loading
Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142
Loading