Skip to content

Instantly share code, notes, and snippets.

@robinhouston
robinhouston / gist:83f0fa99046aeaaf5d27ddbb3218142e
Created September 17, 2020 11:41
Three-digit troll-square matrices
sage: digits = 3
....:
....: for a in range(10^(digits-1), 10^digits - 10^(digits - 1) + 2):
....: x = (10^digits + 1)*a - a^2
....: for b in divisors(x):
....: if 10^(digits - 1) <= b < 10^digits and 10^(digits - 1) <= x//b < 10^digits:
....: print(a, b, "|", x//b, 10^digits + 1 - a)
....:
100 100 | 901 901
100 106 | 850 901