# Finding x from Y

I need to create a program that will output value "x" by giving it value inputing "Y"
The text of the program sounds just like this:

Define the following two operations which can be applied to a natural number "x":
a) multiplying by 2; b) substracting 3;

By entering a number "Y" determine a sequence of operations to reach the number "x" and output this value.

I would be very gratefull for every ideea you could offer me about how to start...

Every bit of information will help

Nick

• : I need to create a program that will output value "x" by giving it value inputing "Y"
: The text of the program sounds just like this:
:
: Define the following two operations which can be applied to a natural number "x":
: a) multiplying by 2; b) substracting 3;
:
: By entering a number "Y" determine a sequence of operations to reach the number "x" and output this value.
:
: I would be very gratefull for every ideea you could offer me about how to start...
:
: Every bit of information will help
:
:
: Nick
:
[blue]
*any* sequence of operations or just the two operations listed?

We useally discourage posting of homework questions here. We will be glad to help, but dont guarentee one to write the program for you.
[/blue]
• : : I need to create a program that will output value "x" by giving it value inputing "Y"
: : The text of the program sounds just like this:
: :
: : Define the following two operations which can be applied to a natural number "x":
: : a) multiplying by 2; b) substracting 3;
: :
: : By entering a number "Y" determine a sequence of operations to reach the number "x" and output this value.
: :
: : I would be very gratefull for every ideea you could offer me about how to start...
: :
: : Every bit of information will help
: :
: :
: : Nick
: :
: [blue]
: *any* sequence of operations or just the two operations listed?
:
: We useally discourage posting of homework questions here. We will be glad to help, but dont guarentee one to write the program for you.
: [/blue]
:

just the two operations listed. Like I said....just an ideea... it's all I need

• : just the two operations listed. Like I said....just an ideea... it's all I need
:

If you can define operations using functions or oop then everything rest is easy.
first substract till y > x
then multiply tillan unrepeated no comes.