Sprime Time

All fans of recreational math love palindromic numbers. It’s mandatory, man. 101, 727, 532235, 8810188, 1367755971795577631 — I love ’em! But where can you go after palindromes? Well, you can go to palindromes in a higher dimension. Numbers like 101, 727, 532235 and 8810188 are 1-d palindromes. That is, they’re palindromic in one dimension: backwards and forwards. But numbers like 181818189 and 646464640 aren’t palindromic in one dimension. They’re palindromic in two dimensions:


1 8 1
8 9 8
1 8 1

n=181818189


6 4 6
4 0 4
6 4 6

n=646464640



They’re 2-d palindromes or spiral numbers, that is, numbers that are symmetrical when written as a spiral. You start with the first digit on the top left, then spiral inwards to the center, like this for a 9-digit spiral (9 = 3×3):


And this for a 36-digit spiral (36 = 6×6):


Spiral numbers are easy to construct, because you can reflect and rotate the numbers in one triangular slice of the spiral to find all the others:


You could say that the seed for the spiral number above is 7591310652, because you can write that number in descending lines, left-to-right, as a triangle.

Here are some palindromic numbers with nine digits in base 3 — as you can see, some are both palindromic numbers and spiral numbers. That is, some are palindromic in both one and two dimensions:

1  0  1

0  1  0

1  0  1

n=101010101


1  0  1

0  2  0

1  0  1

n=101010102


1  1  1

1  0  1

1  1  1

n=111111110


1  1  1

1  1  1

1  1  1

n=111111111


2  0  2

0  1  0

2  0  2

n=202020201


2  0  2

0  2  0

2  0  2

n=202020202


2  2  2

2  1  2

2  2  2

n=222222221


2  2  2

2  2  2

2  2  2

n=222222222


But palindromic primes are even better than ordinary palindromes. Here are a few 1-d palindromic primes in base 10:

101
151
73037
7935397
97356765379
1091544334334451901
1367755971795577631
70707270707
39859395893
9212129
7436347
166000661
313
929


And after 1-d palindromic primes, you can go to 2-d palindromic primes. That is, to spiral primes or sprimes — primes that are symmetrical when written as a spiral:

3 6 3
6 7 6
3 6 3

n=363636367 (prime)
seed=367 (see definition above)


9 1 9
1 3 1
9 1 9

n=919191913 (prime)
seed=913


3 7 8 6 3 6 8 7 3
7 9 1 8 9 8 1 9 7
8 1 9 0 9 0 9 1 8
6 8 0 5 5 5 0 8 6
3 9 9 5 7 5 9 9 3
6 8 0 5 5 5 0 8 6
8 1 9 0 9 0 9 1 8
7 9 1 8 9 8 1 9 7
3 7 8 6 3 6 8 7 3

n=378636873786368737863687378636879189819189819189819189819090909090909090555555557 (prime)
seed=378639189909557 (l=15)


And why stop with spiral numbers — and sprimes — in two dimensions? 363636367 is a 2-sprime, being palindromic in two dimensions. But the digits of a number could be written to form a symmetrical cube in three, four, five and more dimensions. So I assume that there are 3-sprimes, 4-sprimes, 5-sprimes and more out there. Watch this space.