Skip to main content
replaced http://puzzling.stackexchange.com/ with https://puzzling.stackexchange.com/
Source Link

Inspired by this questionthis question which was further inspired by this onethis one, write a program which takes two integers and adds them in a unique way, by performing an OR operation on the segments used to display them in a 7-segment display. For reference, the digits are represented in the following way:

Inspired by this question which was further inspired by this one, write a program which takes two integers and adds them in a unique way, by performing an OR operation on the segments used to display them in a 7-segment display. For reference, the digits are represented in the following way:

Inspired by this question which was further inspired by this one, write a program which takes two integers and adds them in a unique way, by performing an OR operation on the segments used to display them in a 7-segment display. For reference, the digits are represented in the following way:

Tweeted twitter.com/StackCodeGolf/status/736982832032157696
grammar
Source Link
  • Any digit plus itself equals itself
  • 8 plus any digit equals 8
  • 2 plus 1, 3, or 7 equals the letter 'a' (must be lower-case)
  • 4 plus 7 equals either 'q' or 'Q', your choice
  • Numbers should be right-aligned, so the digits should be added from right to left. If one number has more digits than the othersother, the extra digits at the beginning should be unchanged. There are no leading 0's, unless the number is exactly 0.
  • All numbers will be 0 or greater. You don't need to handle a '-' sign. (Mainly because there's no good fit for the sum of a '-' and a '1' or '7'.)
  • Any digit plus itself equals itself
  • 8 plus any digit equals 8
  • 2 plus 1, 3, or 7 equals the letter 'a' (must be lower-case)
  • 4 plus 7 equals either 'q' or 'Q', your choice
  • Numbers should be right-aligned, so the digits should be added from right to left. If one number has more digits than the others, the extra digits at the beginning should be unchanged. There are no leading 0's, unless the number is exactly 0.
  • All numbers will be 0 or greater. You don't need to handle a '-' sign. (Mainly because there's no good fit for the sum of a '-' and a '1' or '7'.)
  • Any digit plus itself equals itself
  • 8 plus any digit equals 8
  • 2 plus 1, 3, or 7 equals the letter 'a' (must be lower-case)
  • 4 plus 7 equals either 'q' or 'Q', your choice
  • Numbers should be right-aligned, so the digits should be added from right to left. If one number has more digits than the other, the extra digits at the beginning should be unchanged. There are no leading 0's, unless the number is exactly 0.
  • All numbers will be 0 or greater. You don't need to handle a '-' sign. (Mainly because there's no good fit for the sum of a '-' and a '1' or '7'.)
Added 'a' and 'Q' examples, and also a non-changing number for baseline test.
Source Link
  • Input: 12345, 123. Output: 12389
  • Input: 88888, 42. Output: 88888
  • Input: 0, 23. Output: 28
  • Input: 120, 240. Output: a80
  • Input: 270, 42. Output: 2Q8 (or 2q8)
  • Input: 1234567890, 1234567890. Output: 1234567890
  • Input: 12345, 123. Output: 12389
  • Input: 88888, 42. Output: 88888
  • Input: 0, 23. Output: 28
  • Input: 12345, 123. Output: 12389
  • Input: 88888, 42. Output: 88888
  • Input: 0, 23. Output: 28
  • Input: 120, 240. Output: a80
  • Input: 270, 42. Output: 2Q8 (or 2q8)
  • Input: 1234567890, 1234567890. Output: 1234567890
edited tags
Link
JohnE
  • 5.1k
  • 1
  • 22
  • 33
Loading
4+7 may be either q or Q
Source Link
Loading
Source Link
Loading