Skip to main content
added 557 characters in body
Source Link
Digital Trauma
  • 73k
  • 9
  • 112
  • 264

Bash + GNU utilities, 26

sort|uniq -u|dc -e1?*?*?*p

The 3 input integers are each given on their own line.

In the case of non-distinct inputs, dcdc warnings are printed to stderr. These may be ignored.

uniq -u does most of the heavy lifting here. With the -u option, only non-duplicated lines are returned. uniq requires its input to be sorted.

The dc expression pushes 1 to the stack, then reads up to 3 integers, multiplying each in turn, then printing the output. If uniq pipes less than 3 integers to dc, then the surplus ? will not add to the stack and the following * will spit out a warning because * needs to pop 2 operands from the stack. But these are just warnings, dc continues execution until it prints the final product.

Try it online!

Bash + GNU utilities, 26

sort|uniq -u|dc -e1?*?*?*p

The 3 input integers are each given on their own line.

In the case of non-distinct inputs, dc warnings are printed to stderr. These may be ignored.

Try it online!

Bash + GNU utilities, 26

sort|uniq -u|dc -e1?*?*?*p

The 3 input integers are each given on their own line.

In the case of non-distinct inputs, dc warnings are printed to stderr. These may be ignored.

uniq -u does most of the heavy lifting here. With the -u option, only non-duplicated lines are returned. uniq requires its input to be sorted.

The dc expression pushes 1 to the stack, then reads up to 3 integers, multiplying each in turn, then printing the output. If uniq pipes less than 3 integers to dc, then the surplus ? will not add to the stack and the following * will spit out a warning because * needs to pop 2 operands from the stack. But these are just warnings, dc continues execution until it prints the final product.

Try it online!

edited body
Source Link
Digital Trauma
  • 73k
  • 9
  • 112
  • 264

Bash + GNU utilities, 26

sort|uniq -u|dc -e1?*?*?*p

The 3 input integers are given each given on their own line.

In the case of non-distinct inputs, dc warnings are printed to stderr. These may be ignored.

Try it online!

Bash + GNU utilities, 26

sort|uniq -u|dc -e1?*?*?*p

The 3 input integers are given each on their own line.

In the case of non-distinct inputs, dc warnings are printed to stderr. These may be ignored.

Try it online!

Bash + GNU utilities, 26

sort|uniq -u|dc -e1?*?*?*p

The 3 input integers are each given on their own line.

In the case of non-distinct inputs, dc warnings are printed to stderr. These may be ignored.

Try it online!

Source Link
Digital Trauma
  • 73k
  • 9
  • 112
  • 264

Bash + GNU utilities, 26

sort|uniq -u|dc -e1?*?*?*p

The 3 input integers are given each on their own line.

In the case of non-distinct inputs, dc warnings are printed to stderr. These may be ignored.

Try it online!