Talk:3x

From Esolang
Jump to navigation Jump to search

Multiplication

I'm pretty sure the multiplication program is incorrect. Below is the corrected version:

??#333x#v333x^#3#v3333x3x3333x3x3^x(3#v3333x3x3333x3x3^x#333x^(3#v3333x3x3333x3x3^x#3#v3333x3x33333xx3^x#)3333x3x#v#)#!

The explanation is as follows:

??                     get inputs a and b
#333x#v                swap a and b, store a at 0
333x^#                 push num at 0, i.e. a, swap
3#v3333x3x3333x3x3^x   decrement b
(3#v3333x3x3333x3x3^x  decrement b
#333x^(                push num at 0
3#v3333x3x3333x3x3^x#  decrement, swap
3#v3333x3x33333xx3^x#) increment, swap
3333x3x#v#             get rid of zero
)#!                    swap and print