Thursday, May 01, 2025

Percy Ludgate: Early Computer Pioneer and his Irish Logarithms

 

Irish Logarithms are a multiplication method invented by Irishman Percy Ludgate in 1909. 

1. Why use Logarithms

a logarithm transforms multiplication into addition:
logb(xy)=logb(x)+logb(y)

By storing precomputed “log” values and then adding them, we reduce the hard part of multiplication to a single addition followed by a lookup (the inverse logarithm).

Classical log-based multiplication steps:

  1. Log lookup: retrieve and from a table.

  2. Add: compute .

  3. Anti-log lookup: retrieve from another table.


2. What Irish Logarithms involve 

To multiply two one digit numbers

table1 = [50, 0, 1, 7, 2, 23, 8, 33, 3, 14]

table2 = [ 1,  2,  4,  8, 16, 32, 64,  3,  6, 12, 
          24, 48,  0,  0,  9, 18, 36, 72,  0,  0, 
           0, 27, 54,  5, 10, 20, 40,  0, 81,  0, 
          15, 30,  0,  7, 14, 28, 56, 45,  0,  0, 
          21, 42,  0,  0,  0,  0, 25, 63,  0,  0, 
           0,  0,  0,  0,  0,  0, 35,  0,  0,  0, 
           0,  0,  0,  0,  0,  0, 49,  0,  0,  0, 
           0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
           0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
           0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
           0]

Lets say 4*5. Look up the 4th position in table 1. That is 2 (table starts at 0). and the 5th is 23. Add these together to get 25.
Now look up the 25th position in table 2 (the anti-log table) is 20. the right answer.

To do multi digit multiplication you do the multiplication of individual digits and then add them like in school. 

Ludgate worked out this logarithm and anti-logarithm mapping himself which in a pre computer time was a huge amount of effort.  As he wrote 'the result of about six years' work, undertaken . . . with the object of designing machinery capable of performing calculations, however, intricate or laborious, without the immediate guidance of the human intellect'

3. Who was Percy Ludgate

He was an Irish accountant and computer pioneer who invented the second ever design for a Turing complete computer. and one that was much more practical than Babbage's. But he never got the money needed to construct it.

Brian Coghlan has done a huge amount of research on Ludgate's computer. There is a popular press  article on Ludgate here

Ludgate's original article describing his computer is here. The Irish logarithms were only one of his inventions needed to make a practical computer. I think his story should be better known. 


4. Hex Irish Logarithms


Here is the python code to work out what the base 16 hex Irish logarithm would be. For no reason other then no one else seems to have worked it out before. 

#!/usr/bin/env python3
# Requires: pip install z3-solver

from z3 import *

# 1. Variables Z0…Z15, plus M
Z0, Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, Z10, Z11, Z12, Z13, Z14, Z15 = \
Ints('Z0 Z1 Z2 Z3 Z4 Z5 Z6 Z7 Z8 Z9 Z10 Z11 Z12 Z13 Z14 Z15')
Z = [Z0, Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, Z10, Z11, Z12, Z13, Z14, Z15]
M = Int('M')

opt = Optimize()

# 2. Symmetry-breaking: log(1)=0, log(2)=1
opt.add(Z1 == 0, Z2 == 1)

# 3. Bounds on Z1…Z15 in [0..M], and send Z0 out-of-range
for i in range(1, 16):
opt.add(Z[i] >= 0, Z[i] <= M)
opt.add(Z0 == M + 1)

# 4. Force worst-case = sum of two largest primes 13+13
opt.add(M == Z13 + Z13)

# 5. Prime-ordering to break permutations
opt.add(Z2 < Z3, Z3 < Z5, Z5 < Z7, Z7 < Z11, Z11 < Z13)

# 6. Collision-avoidance for all non-zero digit-pairs
pairs = [(a, b) for a in range(1, 16) for b in range(a, 16)]
S = {(a, b): Z[a] + Z[b] for (a, b) in pairs}

for i, (a, b) in enumerate(pairs):
for (c, d) in pairs[i+1:]:
if a*b == c*d:
opt.add(S[(a, b)] == S[(c, d)])
else:
opt.add(S[(a, b)] != S[(c, d)])

# 7. Ensure every valid sum ≤ M
for (a, b) in pairs:
opt.add(S[(a, b)] <= M)

# 8. Minimize M
opt.minimize(M)

# 9. Solve & report
if opt.check().r == 1: # sat
model = opt.model()

# Convert each Z[i] (an IntNumRef) into a plain Python int
table1 = [model[Z[i]].as_long() for i in range(16)]

M_val = model[M].as_long()
print("Minimum max-sum M =", M_val)
print("Table1 (Z0…Z15) =", table1)

max_sum = max(table1) + max(table1)
print("Verified max_sum =", max_sum)
else:
print("No solution found")


Minimum max-sum M = 178 Table1 (Z0…Z15) = [179, 0, 1, 21, 2, 51, 22, 77, 3, 42, 52, 85, 23, 89, 78, 72] Verified max_sum = 358







1 comment:

Anonymous said...

I had never heard of Percy Ludgate, this is fascinating stuff.