Skip to main content
TIO link was to the wrong version
Source Link
Business Cat
  • 9.2k
  • 1
  • 18
  • 37

MarioLANG, 121 109 107 bytes

Saved 14 bytes thanks to Martin Ender

;>(-)-)+(([!) )"=========#[ ; +(![-)< )<!+ ==#===" "#: >!< >(+ !![(< =#"="===##=:" ! < #======" 

Try it online!Try it online!

Explanation

The algorithm is simply to keep subtracting d from n to see if you can do it an integer number of times and have no remainder.

; ) ; > =     

First, the input is collected. n is in the first cell, d in the second.

 >(-)-)+(([! "=========# )< " ! #"="===##=     

This is essentially the main loop. It decrements the first and second cells, and increments the third.

 [!) =#[ !+ #:   (<   :"     

This is the final output. If after the incrementing/decrementing, the first cell is 0, then we've eliminated n. If after this, the second cell (d) is 0, then d went into n evenly. We increment and print (1). Otherwise, move back to the first cell (which is 0) and print it.

      +(![-)< ==#==="  !< >(+ !![  #"="===##= ! < #======" 

This loop happens if the second cell is 0 after incrementing and decrementing. It copies the third cell to the second cell. The part at the bottom is to bypass the loop if the cell is not 0.

MarioLANG, 121 109 107 bytes

Saved 14 bytes thanks to Martin Ender

;>(-)-)+(([!) )"=========#[ ; +(![-)< )<!+ ==#===" "#: >!< >(+ !![(< =#"="===##=:" ! < #======" 

Try it online!

Explanation

The algorithm is simply to keep subtracting d from n to see if you can do it an integer number of times and have no remainder.

; ) ; > =     

First, the input is collected. n is in the first cell, d in the second.

 >(-)-)+(([! "=========# )< " ! #"="===##=     

This is essentially the main loop. It decrements the first and second cells, and increments the third.

 [!) =#[ !+ #:   (<   :"     

This is the final output. If after the incrementing/decrementing, the first cell is 0, then we've eliminated n. If after this, the second cell (d) is 0, then d went into n evenly. We increment and print (1). Otherwise, move back to the first cell (which is 0) and print it.

      +(![-)< ==#==="  !< >(+ !![  #"="===##= ! < #======" 

This loop happens if the second cell is 0 after incrementing and decrementing. It copies the third cell to the second cell. The part at the bottom is to bypass the loop if the cell is not 0.

MarioLANG, 121 109 107 bytes

Saved 14 bytes thanks to Martin Ender

;>(-)-)+(([!) )"=========#[ ; +(![-)< )<!+ ==#===" "#: >!< >(+ !![(< =#"="===##=:" ! < #======" 

Try it online!

Explanation

The algorithm is simply to keep subtracting d from n to see if you can do it an integer number of times and have no remainder.

; ) ; > =     

First, the input is collected. n is in the first cell, d in the second.

 >(-)-)+(([! "=========# )< " ! #"="===##=     

This is essentially the main loop. It decrements the first and second cells, and increments the third.

 [!) =#[ !+ #:   (<   :"     

This is the final output. If after the incrementing/decrementing, the first cell is 0, then we've eliminated n. If after this, the second cell (d) is 0, then d went into n evenly. We increment and print (1). Otherwise, move back to the first cell (which is 0) and print it.

      +(![-)< ==#==="  !< >(+ !![  #"="===##= ! < #======" 

This loop happens if the second cell is 0 after incrementing and decrementing. It copies the third cell to the second cell. The part at the bottom is to bypass the loop if the cell is not 0.

Saved some bytes
Source Link
Business Cat
  • 9.2k
  • 1
  • 18
  • 37

MarioLANG, 121121 109 107 bytes

Saved 14 bytes thanks to Martin Ender

;>( -)-)+(([!)[!+: )"==========#==#=="=========#[ ; +(![-)<  )< >(:!+ ==#===" =" "=="#: >!< >(+ !![(< =#"="===##=:" ! < #======" 

May not be the optimum solution but I already golfed it down quite a bit.

Try it online!Try it online!

Explanation

The algorithm is simply to keep subtracting d from n to see if you can do it an integer number of times and have no remainder.

; ) ; > =     

First, the input is collected. n is in the first cell, d in the second.

 >( -)-)+(([! "==========#"=========#   )< ="" ! #"="===##=     

This is essentially the main loop. It decrements the first and second cells, and increments the third.

 [!+:) =#===#[ >(: !+ "== #:   (<   :"     

This is the final output. If after the incrementing/decrementing, the first cell is 0, then we've eliminated n. If after this, the second cell (d) is 0, then d went into n evenly. We increment and print (1). Otherwise, move back to the first cell (which is 0) and print it.

      +(![-)< ==#==="  !< >(+ !![  #"="===##= ! < #======" 

This loop happens if the second cell is 0 after incrementing and decrementing. It copies the third cell to the second cell. The part at the bottom is to bypass the loop if the cell is not 0.

MarioLANG, 121 bytes

;>( -)-)+(([!)[!+: )"==========#==#== ; +(![-)<  )< >(: ==#===" =" "== >!< >(+ !![ =#"="===##= ! < #======" 

May not be the optimum solution but I already golfed it down quite a bit.

Try it online!

Explanation

The algorithm is simply to keep subtracting d from n to see if you can do it an integer number of times and have no remainder.

; ) ; > =     

First, the input is collected. n is in the first cell, d in the second.

 >( -)-)+(([! "==========#   )< =" ! #"="===##=     

This is essentially the main loop. It decrements the first and second cells, and increments the third.

 [!+: =#== >(: "==         

This is the final output. If after the incrementing/decrementing, the first cell is 0, then we've eliminated n. If after this, the second cell (d) is 0, then d went into n evenly. We increment and print (1). Otherwise, move back to the first cell (which is 0) and print it.

      +(![-)< ==#==="  !< >(+ !![  #"="===##= ! < #======" 

This loop happens if the second cell is 0 after incrementing and decrementing. It copies the third cell to the second cell. The part at the bottom is to bypass the loop if the cell is not 0.

MarioLANG, 121 109 107 bytes

Saved 14 bytes thanks to Martin Ender

;>(-)-)+(([!) )"=========#[ ; +(![-)< )<!+ ==#===" "#: >!< >(+ !![(< =#"="===##=:" ! < #======" 

Try it online!

Explanation

The algorithm is simply to keep subtracting d from n to see if you can do it an integer number of times and have no remainder.

; ) ; > =     

First, the input is collected. n is in the first cell, d in the second.

 >(-)-)+(([! "=========# )< " ! #"="===##=     

This is essentially the main loop. It decrements the first and second cells, and increments the third.

 [!) =#[  !+  #:   (<   :"     

This is the final output. If after the incrementing/decrementing, the first cell is 0, then we've eliminated n. If after this, the second cell (d) is 0, then d went into n evenly. We increment and print (1). Otherwise, move back to the first cell (which is 0) and print it.

      +(![-)< ==#==="  !< >(+ !![  #"="===##= ! < #======" 

This loop happens if the second cell is 0 after incrementing and decrementing. It copies the third cell to the second cell. The part at the bottom is to bypass the loop if the cell is not 0.

Source Link
Business Cat
  • 9.2k
  • 1
  • 18
  • 37

MarioLANG, 121 bytes

;>( -)-)+(([!)[!+: )"==========#==#== ; +(![-)< )< >(: ==#===" =" "== >!< >(+ !![ =#"="===##= ! < #======" 

May not be the optimum solution but I already golfed it down quite a bit.

Try it online!

Explanation

The algorithm is simply to keep subtracting d from n to see if you can do it an integer number of times and have no remainder.

; ) ; > =     

First, the input is collected. n is in the first cell, d in the second.

 >( -)-)+(([! "==========# )< =" ! #"="===##=     

This is essentially the main loop. It decrements the first and second cells, and increments the third.

 [!+: =#== >(: "==         

This is the final output. If after the incrementing/decrementing, the first cell is 0, then we've eliminated n. If after this, the second cell (d) is 0, then d went into n evenly. We increment and print (1). Otherwise, move back to the first cell (which is 0) and print it.

      +(![-)< ==#==="  !< >(+ !![  #"="===##= ! < #======" 

This loop happens if the second cell is 0 after incrementing and decrementing. It copies the third cell to the second cell. The part at the bottom is to bypass the loop if the cell is not 0.