Skip to main content
formatting oopsie
Source Link
Jo King
  • 47.5k
  • 5
  • 125
  • 186

Befunge-93, 20 19 bytes

&+#v:!_:
\@#<*_\:.#

Try it online!

Reposting more of my answers from the old challenge that didn't fit the requirements. This one didn't get up to 125!, at least with this interpreter.

Explanation:

&           Get the input
 +          Add it to the current counter (initially 0)
    :!_     Duplicate and check if it is zero
&+     :    If not, duplicate and repeat, but add the -1 from EOF to the input
  #v:!      If it is, not the 0 into a 1, duplicate and go to the second line
            This initialises the stack as n,n-1,n-2...,1,1,1
   <        Start going left
\    _ :    Check if the second element on the stack is zero
    *       If not, then multiply the top two elements
 @#   \ .#  If it is, then print the factorial value and terminate

\ _ : Check if the second element on the stack is zero * If not, then multiply the top two elements @# \ .# If it is, then print the factorial value and terminate

I believe this was actually my first answer on this site, with the below being the 20 byte version of the above.

Befunge-93, 20 bytes

1&0>-#1:__\#0:#*_$.@

Try it online!

Befunge-93, 20 19 bytes

&+#v:!_:
\@#<*_\:.#

Try it online!

Reposting more of my answers from the old challenge that didn't fit the requirements. This one didn't get up to 125!, at least with this interpreter.

Explanation:

&           Get the input
 +          Add it to the current counter (initially 0)
    :!_     Duplicate and check if it is zero
&+     :    If not, duplicate and repeat, but add the -1 from EOF to the input
  #v:!      If it is, not the 0 into a 1, duplicate and go to the second line
            This initialises the stack as n,n-1,n-2...,1,1,1
   <        Start going left

\ _ : Check if the second element on the stack is zero * If not, then multiply the top two elements @# \ .# If it is, then print the factorial value and terminate

I believe this was actually my first answer on this site, with the below being the 20 byte version of the above.

Befunge-93, 20 bytes

1&0>-#1:__\#0:#*_$.@

Try it online!

Befunge-93, 20 19 bytes

&+#v:!_:
\@#<*_\:.#

Try it online!

Reposting more of my answers from the old challenge that didn't fit the requirements. This one didn't get up to 125!, at least with this interpreter.

Explanation:

&           Get the input
 +          Add it to the current counter (initially 0)
    :!_     Duplicate and check if it is zero
&+     :    If not, duplicate and repeat, but add the -1 from EOF to the input
  #v:!      If it is, not the 0 into a 1, duplicate and go to the second line
            This initialises the stack as n,n-1,n-2...,1,1,1
   <        Start going left
\    _ :    Check if the second element on the stack is zero
    *       If not, then multiply the top two elements
 @#   \ .#  If it is, then print the factorial value and terminate

I believe this was actually my first answer on this site, with the below being the 20 byte version of the above.

Befunge-93, 20 bytes

1&0>-#1:__\#0:#*_$.@

Try it online!

-1 byte
Source Link
Jo King
  • 47.5k
  • 5
  • 125
  • 186

Befunge-93, 2020 19 bytes

&0>-#1&+#v:_!>\# _:#*_$
\@#<*_\:.@#

Try it online!Try it online!

Reposting more of my answers from the old challenge that didn't fit the requirements. This one didn't get up to 125!, at least with this interpreter. I believe this was actually my first answer on this site! I've cleaned it up a little and made some modifications.

Explanation:

&                      Get the input
 0>-#1:_   +          Add it Duplicateto the input and subtract 1 untilcurrent itcounter reaches(initially zero0)
        :!>     _       Turn that zero into an initial oneDuplicate and start the loop
 check if it is zero
&+    >\# :    If not, duplicate and repeat, but Swapsadd the two-1 topfrom valuesEOF ofto the stackinput
             #v:# _  !    Duplicate the top value, and terminate ifIf it is, 0.
not the 0 into a 1, duplicate and go >to #the second #*_line
      If not, multiply the top two valuesThis ofinitialises the stack and repeat theas loopn,n-1,n-2...,1,1,1
                 $.@<   Finally, print the factorial and exitStart thegoing programleft

An alternative with\ _ : Check if the same amount of bytes, which dependssecond element on EOF beingthe stack is zero * If not, then multiply the top two elements @# \ -1 for numbers.# If it is, then print the factorial value and terminate

I believe this was actually my first answer on this site, with the below being the 20 byte version of the above.

Befunge-93, 20 bytes

&+#v:!_1&0>-#1:
\@#<*_$#__\#0:#*_$.#@

Try it online!Try it online!

Befunge-93, 20 bytes

&0>-#1:_!>\# :#*_$.@

Try it online!

Reposting more of my answers from the old challenge that didn't fit the requirements. This one didn't get up to 125!, at least with this interpreter. I believe this was actually my first answer on this site! I've cleaned it up a little and made some modifications.

Explanation:

&                      Get the input
 0>-#1:_               Duplicate the input and subtract 1 until it reaches zero
        !>     _       Turn that zero into an initial one and start the loop
         >\#           Swaps the two top values of the stack
             :# _      Duplicate the top value, and terminate if it is 0.
         > #  #*_      If not, multiply the top two values of the stack and repeat the loop
                 $.@   Finally, print the factorial and exit the program

An alternative with the same amount of bytes, which depends on EOF being -1 for numbers.

&+#v:!_:
\@#<*_$#:.#

Try it online!

Befunge-93, 20 19 bytes

&+#v:!_:
\@#<*_\:.#

Try it online!

Reposting more of my answers from the old challenge that didn't fit the requirements. This one didn't get up to 125!, at least with this interpreter.

Explanation:

&           Get the input
 +          Add it to the current counter (initially 0)
    :!_     Duplicate and check if it is zero
&+     :    If not, duplicate and repeat, but add the -1 from EOF to the input
  #v:!      If it is, not the 0 into a 1, duplicate and go to the second line
            This initialises the stack as n,n-1,n-2...,1,1,1
   <        Start going left

\ _ : Check if the second element on the stack is zero * If not, then multiply the top two elements @# \ .# If it is, then print the factorial value and terminate

I believe this was actually my first answer on this site, with the below being the 20 byte version of the above.

Befunge-93, 20 bytes

1&0>-#1:__\#0:#*_$.@

Try it online!

Source Link
Jo King
  • 47.5k
  • 5
  • 125
  • 186

Befunge-93, 20 bytes

&0>-#1:_!>\# :#*_$.@

Try it online!

Reposting more of my answers from the old challenge that didn't fit the requirements. This one didn't get up to 125!, at least with this interpreter. I believe this was actually my first answer on this site! I've cleaned it up a little and made some modifications.

Explanation:

&                      Get the input
 0>-#1:_               Duplicate the input and subtract 1 until it reaches zero
        !>     _       Turn that zero into an initial one and start the loop
         >\#           Swaps the two top values of the stack
             :# _      Duplicate the top value, and terminate if it is 0.
         > #  #*_      If not, multiply the top two values of the stack and repeat the loop
                 $.@   Finally, print the factorial and exit the program

An alternative with the same amount of bytes, which depends on EOF being -1 for numbers.

&+#v:!_:
\@#<*_$#:.#

Try it online!