Script - Bitcoin Programming Discussion

The answer is 2 2 OP_MUL 3 3 OP_MUL OP_ADD.

1 Like

assignment:
2 2 OP_MUL 3 3 OP_MUL OP_ADD

2 Likes

Answer:
2 2 OP_MUL 3 3 OP_MUL OP_ADD

1 Like

Stack Assignment

The words used in the script are found in the Bitcon script wiki page.
Script: 2 OP_2MUL 3 3 OP_MUL OP_ADD
Runs like this: 2 OP_2MUL ==> 4 3 3 OP_MUL ==> 4 9 OP_ADD ==> 0xD

2 Likes

Answer:

2 2 OP_MUL 3 3 OP_MUL OP_ADD

1 Like

Answer:

2 2 OP_MUL
3 3 OP_MUL
OP_ADD
1 Like

2 2 op_add 3 3 op_mul op_add

No correct but correct answer as 2*2=4 and 2+2=4, I should have used op_mul in the first expression.

1 Like

You can edit the post btw :slight_smile:
image

2 2 OP_MUL 3 3 OP_MUL OP_ADD

Done

1 Like

Stack Programming Assignment answer

2 2 OP_MUL 3 3 OP_MUL OP_ADD

1 Like

2 2 OP_MUL 3 3 OP_MUL OP_ADD
simple enough…

1 Like

Here’s my answer:
2 2 op_mul
3 3 op_mul
op_add

This is my first time coding stack based programming, very interesting!
It feels like coding assembly xD

1 Like

2 2 op_mul 3 3 op_mul op_add

1 Like

2 2 op_mul 3 3 op_mul op_add

1 Like

2 2 op_mul 3 3 op_mul op_add

1 Like

Originally we can do:

2 2 OP_MUL 3 3 OP_MUL OP_ADD

which gives us a result of 13, or 0xD in hexidecimal.

However, the OP_MUL operation is disabled.

So alternatively we can do:

2 2 OP_ADD 3 3 OP_ADD 3 OP_ADD OP_ADD

which uses only the OP_ADD operation,

:slightly_smiling_face:

1 Like

1 Like

While this does give the same result, the formula is technically different (2 + 2 + 3 + 3 + 3) so I wouldn’t say its really correct. For example if you change the values, you would also have to update the formula :slight_smile: still good thinking :raised_hands:

Hey, thanks for the feedback :cowboy_hat_face:

Do you know how you would go about doing this then without use of the OP_MUL disabled operation?
Cheers!