My friend and I were talking about primality testing, and he showed me a really neat way to test if something is prime or not. The thing is, we have no idea how it works.
So, we want to test if $n$ is prime. Draw an $n$-gon. Start at any vertex, and draw a line from that point to the adjacent vertex (this can be any direction as long as it's consistent through the whole process). Then go from that vertex, and go over two vertices. Start there and go over 3 vertices, etc. until the pattern repeats itself. For example, if $n$ is $5$ we draw a pentagon:
• (a)
• (e) • (b)
• (d) • (c)
And A->B, then B->D, then, D->B, then B->A, and finally A->A (you don't have to draw anything). The sequence then repeats itself infinitely so we stop there. What we've found is that for any $n$-gon where $n$ is prime (and only when $n$ is prime), no vertices have more than one line drawn to them. Intuitively I have some idea of why this means it's prime, but I can't exactly grasp it.
Pictures:
Why does this work? Does it even work past a certain number? What's the mathematical principle behind it, and can we represent this test mathematically without drawing shapes?


Note: this is not a complete solution, but rather, a not-too-beautifully constructed proof of half the claim ("If you get multiple hits, then $n$ isn't prime"), with a brief discussion of why the other half might be true, but why it's a bit marginal, and leaves me doubting that it works.
The vertices you hit (assuming the starting vertex is labelled $0$ are of the form $$ 1\\ 1 + 2\\ 1 + 2 + 3 \\ \ldots $$ all $\bmod n$, where $n$ is the number you're testing for primality. These can be rewritten in the form $1 + 2 + \ldots + k = \frac{k(k+1)}{2}$, so you're getting vertices $$ 1\\ \frac{1(2)}{2} \\ \frac{2(3)}{2} \\ \frac{3(4)}{2} \\ \frac{4(5)}{2} \\ \ldots $$
(again, all $\bmod n$). Suppose that two of these are equal, i.e., that $$ \frac{u(u+1)}{2} = \frac{v(v+1)}{2} \bmod n $$
Then $$ u^2 + u - v^2 - v = 0 \bmod n $$ and thus $$ (u+v)(u-v) + (u-v) = 0 \bmod n $$ and hence $$ (u+v+1)(u-v) = 0 \bmod n $$ Now since $u$ and $v$ are distinct, that means that $u-v$ divides $n$, and (if it's not $1$) that $n$ is not prime.
So I guess that shows that if you get a repeat, then $n$ is not prime.
What's not clear is that if $n$ is not prime, then you must get repeats, for if your polygon comes back to vertex $0$ after some numbers of steps less than, say, $\sqrt{n}$, then there might be a factor that you "never get a chance to see." On the other hand, in $\sqrt{n}$ steps, you only get a sum that's $\sqrt{n} (\sqrt{n} + 1)$ in size, i.e., $n + \sqrt{n}$. So this is right on the margin.
It's POSSIBLE that the loop closes up in just under $\sqrt{n}$ steps, but that $n$ itself happens to be the square of a prime. You'd have to prove that can't happen before I'd believe the "only if" part of the claim.
(And hence, as @Bram28 / @Nilknarf observe, you don't have a primality checker until you do this "marginal" part.)