This is the Cann Heuristic with one question added: where does each line actually land on a
whole-number coordinate? The original page only reported the blue×pink crossing
points. This version walks every line and records every lattice point it passes through.
The two line families
Lower lines (blue), one per power of two a:y = x / a,
from (0, 0) through (a, 1). Both coordinates are whole exactly when
x is a multiple of a, so the line hits lattice points at
x = 0, a, 2a, 3a… with y = x / a.
Upper lines (pink), one per power of two b:y = N − x(b+1)/b, from (0, N) through
(b, N−b−1). Because b and b+1 are coprime,
x must again be a multiple of b, giving
x = kb, y = N − k(b+1) for as long as y stays at or
above 0.
Reading the lattice map
The map below the geometry has one row per line and one column per integer x from 0 to N. A
dot means that line passes exactly through a whole-number point in that column.
Gold dashed columns are the non-trivial divisors of N.
Gold rings mark a lattice point sitting in a divisor column.
Large gold dots are the payoff: a column where a blue line and a pink line meet
at the same lattice point. Those are the heuristic's crossings with both coordinates
whole.
Resonance: the real signal
Requiring a crossing to land exactly on the lattice throws away most of what the geometry knows.
Solving the two lines gives x = Nab/D and y = Nb/D with
D = a + b + ab = (a+1)(b+1) − 1. A lattice hit needs D | Nb —
but if D merely shares a factor with N, that shared factor is already a factor of N.
Working the condition through, a lattice hit happens only when N has a divisor of the form
1 + 2d + 2M — a divisor with at most three bits set. That
is why 143 = 11·13 works so well (11 = 1011, 13 = 1101, both
three-bit) and why 1081 = 23·47 shows nothing at all (23 = 10111,
47 = 101111). Taking gcd(D, N) instead lifts 1081 straight out:
a = 4, b = 128 gives D = 644 = 2²·7·23, and gcd(644, 1081) = 23.
Green rings mark these resonant crossings. Most gold dots carry one too, since
D | Nb with D > b forces D to share something with N. The exception
is when D is itself a multiple of N: then gcd(D, N) = N, which names no factor, and
the dot gets no ring. Those cases still appear in the whole-coordinate table below, where
gcd(y, N) can pick the factor up instead.
What it is not: the two families offer only about
log²N denominators, while catching an arbitrary factor needs on the order of
√N. Across odd semiprimes below 20,000 this takes the hit rate from roughly
80% to 97%, but by the time the factors reach 16 bits it is under 2%. Swapping every D for a
random number of the same size does just as well or better at every size tested, so the lines
themselves carry no extra information about the factors. It is a better lens on the structure,
not a factoring method.
The gcd idea itself is sound — it just needs a reason for the factor to divide the number
you build. Pollard's Rho supplies one and finds a factor
in about √p steps.
The density strip
Underneath, one bar per column counts how many lines land on a lattice point there. Because every
line's x-step is a power of two, a column x collects one hit for each power of two
dividing it — so the tall bars sit on 16, 32, 64, 128… and the strip reads as the
2-adic texture of the interval, not as a divisor finder. The divisors of N are drawn in gold on
the same axis so you can see exactly where they fall against that texture: usually in an ordinary
column, which is the honest shape of this heuristic.
Cann Heuristic — Lattice Map
Lower line y = x/aUpper line y = N − x(b+1)/bInteger lattice pointCrossing with both coordinates wholegcd(D, N) > 1 — a factor, on or off the lattice
Lattice Map — where each line hits a whole-number point
One row per line, one column per integer x in 0…N. Hover a dot for its coordinates.
Lattice Hits per Column
How many lines land on a whole-number point at each integer x. Gold bars are divisors of
N; the tall bars are the highly 2-divisible columns.
Resonant Crossings — gcd(D, N) > 1
Every crossing has denominator D = (a+1)(b+1) − 1. When D shares a factor with
N, that factor is N's — even when the crossing itself misses the lattice.
Crossings With Both Coordinates Whole
Blue×pink intersections that land exactly on the lattice.
Per-Line Breakdown
Every line, its lattice step, and the columns it touches.