Skip to main content
added 207 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71

Analysis:

Analysis

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.

    z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.

    Some specific cases:

    • +, -: Should be possible. Analysis pending.
    • v and ~: This can only decrease the value on the top of the stack without reducing the stack depth, so I think it's impossible.
    • %: Equivalent to o in this particular case, because x%(x+1)==x.
    • /: Obviously impossible because x/(x+1)==0 and x/0 raises an error.
    • |: Possible. (this also decrease the stack depth by 2 each time instead of 1) Used in this answer.
    • * and ^: Because there can only a limited number of possible results, I'm not very sure this is useful.

    Note that "impossible" means "impossible to do efficiently", because zP alone is sufficient.

Note that "impossible" means "impossible to do efficiently", because zP alone is sufficient.

  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).

    z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).

Analysis:

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.

Note that "impossible" means "impossible to do efficiently", because zP alone is sufficient.

  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).

Analysis

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.

    Some specific cases:

    • +, -: Should be possible. Analysis pending.
    • v and ~: This can only decrease the value on the top of the stack without reducing the stack depth, so I think it's impossible.
    • %: Equivalent to o in this particular case, because x%(x+1)==x.
    • /: Obviously impossible because x/(x+1)==0 and x/0 raises an error.
    • |: Possible. (this also decrease the stack depth by 2 each time instead of 1) Used in this answer.
    • * and ^: Because there can only a limited number of possible results, I'm not very sure this is useful.

    Note that "impossible" means "impossible to do efficiently", because zP alone is sufficient.

  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).

added 207 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71

dc (GNU), 3 distinct characters (z|P), 453 bytes

Generator program: Try it online!

Because there can be a lot of possible different states of the stack, this solution prunes the states to be considered (only the topmost 2 can have value different from the default value pushed by z); therefore the result might not be optimal. (after thinking about it for a while, turns out that finding a good solution is terribly hard)

Analysis:

There are some options of using a digit, an arithmetic operator and P.

Possible cases for the arithmetic operator are:

  • +: 1065 bytes. (proven to be optimal) Throws a lot of errors. Generator program: Try it online!
  • v: 7617 bytes. (proven to be optimal) you can get it from the generator program above by removing the solve(bestReprAdd), line in the generator)
  • -: will probably result in the approximately-same or slightly-shorter program.
  • %: obviously impossible. (because, for example, 11111 mod 111 is 11, so the constructible values are those already constructible with a literal or 0)
  • ~: (unfortunately) also impossible because there's no way to discard the remainder without printing it out.
  • / and |: should be possible. Analysis pending.
  • * and ^: probably impossible, because there can only be a small set of representable numbers.
  • i: An interesting possibility (11i to increase the input base, 1i to set the input base to 1); however the input base must be between 2 and 16, so there's no way to decrease the input base, so it's not very likely to work.

Other alternatives:

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.

Note that "impossible" means "impossible to do efficiently", because zP alone is sufficient.

  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).

dc (GNU), 3 distinct characters (z|P), 453 bytes

Generator program: Try it online!

Because there can be a lot of possible different states of the stack, this solution prunes the states to be considered (only the topmost 2 can have value different from the default value pushed by z); therefore the result might not be optimal.

Analysis:

There are some options of using a digit, an arithmetic operator and P.

Possible cases for the arithmetic operator are:

  • +: 1065 bytes. (proven to be optimal) Throws a lot of errors. Generator program: Try it online!
  • v: 7617 bytes. (proven to be optimal) you can get it from the generator program above by removing the solve(bestReprAdd), line in the generator)
  • -: will probably result in the approximately-same or slightly-shorter program.
  • %: obviously impossible. (because, for example, 11111 mod 111 is 11, so the constructible values are those already constructible with a literal or 0)
  • ~: (unfortunately) also impossible because there's no way to discard the remainder without printing it out.
  • / and |: should be possible. Analysis pending.
  • * and ^: probably impossible, because there can only be a small set of representable numbers.
  • i: An interesting possibility (11i to increase the input base, 1i to set the input base to 1); however the input base must be between 2 and 16, so there's no way to decrease the input base, so it's not very likely to work.

Other alternatives:

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.
  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).

dc (GNU), 3 distinct characters (z|P), 453 bytes

Generator program: Try it online!

Because there can be a lot of possible different states of the stack, this solution prunes the states to be considered (only the topmost 2 can have value different from the default value pushed by z); therefore the result might not be optimal. (after thinking about it for a while, turns out that finding a good solution is terribly hard)

Analysis:

There are some options of using a digit, an arithmetic operator and P.

Possible cases for the arithmetic operator are:

  • +: 1065 bytes. (proven to be optimal) Throws a lot of errors. Generator program: Try it online!
  • v: 7617 bytes. (proven to be optimal) you can get it from the generator program above by removing the solve(bestReprAdd), line in the generator)
  • -: will probably result in the approximately-same or slightly-shorter program.
  • %: obviously impossible. (because, for example, 11111 mod 111 is 11, so the constructible values are those already constructible with a literal or 0)
  • ~: (unfortunately) also impossible because there's no way to discard the remainder without printing it out.
  • / and |: should be possible. Analysis pending.
  • * and ^: probably impossible, because there can only be a small set of representable numbers.
  • i: An interesting possibility (11i to increase the input base, 1i to set the input base to 1); however the input base must be between 2 and 16, so there's no way to decrease the input base, so it's not very likely to work.

Other alternatives:

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.

Note that "impossible" means "impossible to do efficiently", because zP alone is sufficient.

  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).
added 65 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71

dc (GNU), 3 distinct characters (z|P), 453 bytes

Generator program: Try it online!

Because there can be a lot of possible different states of the stack, this solution prunes the states to be considered (only the topmost 2 can have value different from the default value pushed by z); therefore the result might not be optimal.

Analysis:

There are some options of using a digit, an arithmetic operator and P.

Possible cases for the arithmetic operator are:

  • +: 1065 bytes. (proven to be optimal) Throws a lot of errors. Generator program: Try it online!
  • v: 7617 bytes. (youproven to be optimal) you can get it from the generator program above by removing the solve(bestReprAdd), line in the generator)
  • -: will probably result in the approximately-same or slightly-shorter program.
  • %: obviously impossible. (because, for example, 11111 mod 111 is 11, so the constructible values are those already constructible with a literal or 0)
  • ~: (unfortunately) also impossible because there's no way to discard the remainder without printing it out.
  • / and |: should be possible. Analysis pending.
  • * and ^: probably impossible, because there can only be a small set of representable numbers.
  • i: An interesting possibility (11i to increase the input base, 1i to set the input base to 1); however the input base must be between 2 and 16, so there's no way to decrease the input base, so it's not very likely to work.

Other alternatives:

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.
  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).

dc (GNU), 3 distinct characters (z|P), 453 bytes

Generator program: Try it online!

Because there can be a lot of possible different states of the stack, this solution prunes the states to be considered (only the topmost 2 can have value different from the default value pushed by z); therefore the result might not be optimal.

Analysis:

There are some options of using a digit, an arithmetic operator and P.

Possible cases for the arithmetic operator are:

  • +: 1065 bytes. Throws a lot of errors. Generator program: Try it online!
  • v: 7617 bytes. (you can get it from the generator program above by removing the solve(bestReprAdd), line in the generator)
  • -: will probably result in the approximately-same or slightly-shorter program.
  • %: obviously impossible. (because, for example, 11111 mod 111 is 11, so the constructible values are those already constructible with a literal or 0)
  • ~: (unfortunately) also impossible because there's no way to discard the remainder without printing it out.
  • / and |: should be possible. Analysis pending.
  • * and ^: probably impossible, because there can only be a small set of representable numbers.
  • i: An interesting possibility (11i to increase the input base, 1i to set the input base to 1); however the input base must be between 2 and 16, so there's no way to decrease the input base, so it's not very likely to work.

Other alternatives:

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.
  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes.

dc (GNU), 3 distinct characters (z|P), 453 bytes

Generator program: Try it online!

Because there can be a lot of possible different states of the stack, this solution prunes the states to be considered (only the topmost 2 can have value different from the default value pushed by z); therefore the result might not be optimal.

Analysis:

There are some options of using a digit, an arithmetic operator and P.

Possible cases for the arithmetic operator are:

  • +: 1065 bytes. (proven to be optimal) Throws a lot of errors. Generator program: Try it online!
  • v: 7617 bytes. (proven to be optimal) you can get it from the generator program above by removing the solve(bestReprAdd), line in the generator)
  • -: will probably result in the approximately-same or slightly-shorter program.
  • %: obviously impossible. (because, for example, 11111 mod 111 is 11, so the constructible values are those already constructible with a literal or 0)
  • ~: (unfortunately) also impossible because there's no way to discard the remainder without printing it out.
  • / and |: should be possible. Analysis pending.
  • * and ^: probably impossible, because there can only be a small set of representable numbers.
  • i: An interesting possibility (11i to increase the input base, 1i to set the input base to 1); however the input base must be between 2 and 16, so there's no way to decrease the input base, so it's not very likely to work.

Other alternatives:

  • z, P, (arithmetic operator): Terribly hard to analyze. Using zP| results in the solution above.
  • z, P, o (since the output radix is not used, it's the same as pop the stack and do nothing in this challenge): 1601 bytes (obviously optimal).
deleted 52 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71
Loading
added 1712 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71
Loading
added 27 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71
Loading
added 476 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71
Loading
added 232 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71
Loading
added 131 characters in body
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71
Loading
Source Link
user202729
  • 17.6k
  • 2
  • 39
  • 71
Loading