Puzzle
1 minute read

Ponder This Challenge - December 2015 - EBCDIC to ASCII conversion

Ponder This Challenge:

Last month, Gene Amdahl, an IBM fellow who was the chief architect of the legendary IBM 360 system, died at age 92.
In memory of his work, this month's challenge focuses on the IBM-360 character set (EBCDIC):
Find a formula to convert the 52 EBCDIC letters into ASCII using no more than 4 operators.
See http://www-01.ibm.com/support/knowledgecenter/SSGH4D_15.1.0/com.ibm.xlf151.aix.doc/language_ref/asciit.html?lang=en for the ASCII and EBCDIC character sets.

Supply your answer as a mathematical expression. For example, one can switch from lower-case ASCII to uppercase ASCII (and vice versa) using a single operation: f(x)=x xor 32.

Solution

  • Several solvers implemented a lookup table in three operations, like Dan Dima's solution
    (90089088087086085084083000000000000000000000000082081080079078077076075074000000000000000000000073072071070069068067066065000000000000000000000000000000000000000000000000000000000000000000000122121120119118117116115000000000000000000000000114113112111110109108107106000000000000000000000105104103102101100099098097000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 / (1000 ** x)) modulo 1000.

    Septimus G. Stevens VII suggested a smaller lookup table: x - (9592598315813 % (81 + (x & 112))).
    Motty Porat used a similar approach with only 3 operations: x - (309276143438415101 mod (x | 1039)).
    Yan-Wu He proposed another solution: ((0x010101010101 * x) & 0x20300080F0BF) modulo 513.

Solvers

  • James Dow Allen (02/12/2015 11:40 AM IDT)
  • Septimus Stevens (03/12/2015 04:43 AM IDT)
  • Christian Häggström (03/12/2015 10:09 AM IDT)
  • Kang Jin Cho (04/12/2015 01:54 PM IDT)
  • Armin Krauss (08/12/2015 01:16 PM IDT)
  • Yan-Wu He (08/12/2015 05:31 PM IDT)
  • Brian Huffman (10/12/2015 06:21 AM IDT)
  • David Harrison (11/12/2015 02:13 AM IDT)
  • Robert Gerbicz (11/12/2015 04:45 PM IDT)
  • Anders Bisbjerg Madsen (15/12/2015 09:18 PM IDT)
  • Shirish Chinchalkar (17/12/2015 06:59 AM IDT)
  • David Dunkley (17/12/2015 10:38 AM IDT)
  • Pataki Gida (19/12/2015 06:21 PM IDT)
  • Michael Rosola (19/12/2015 09:52 PM IDT)
  • Harald Bögeholz (20/12/2015 07:42 PM IDT)
  • Gregory Giecold (21/12/2015 06:40 AM IDT)
  • Andreas Stiller (23/12/2015 02:50 AM IDT)
  • Mathias Schenker (26/12/2015 10:52 AM IDT)
  • Motty Porat (28/12/2015 05:10 PM IDT)
  • David Greer (01/01/2016 05:25 AM IDT)
  • Gringo (02/01/2016 08:05 PM IDT)

Related posts