Non-working table-generation ported from C code.

- There's no reason to create the lookup table right now; I'm not
  worrying about optimizing.
- I will instead try to inline what the lookup would get for each step.
- Use Rosetta-code reference implementation in C