login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A345145
Lexicographically earliest sequence of nonnegative terms forming a clockwise square spiral when nothing else is read except the prime/nonprime nature of the terms or the prime/nonprime nature of the digits (see the Comments section).
0
0, 2, 3, 1, 5, 4, 7, 6, 8, 29, 9, 20, 11, 21, 10, 24, 19, 12, 14, 16, 31, 18, 40, 26, 44, 41, 28, 46, 48, 15, 61, 49, 60, 30, 64, 66, 89, 34, 68, 69, 80, 36, 101, 81, 84, 38, 86, 88, 90, 13, 91, 94, 96, 98, 42, 99, 109, 100, 45, 104, 106, 108, 62, 110, 149, 111, 63, 114, 116, 118, 102, 119, 181, 140, 105
OFFSET
1,2
COMMENTS
A nonprime term turns the pencil 0 degree to the right, then advances 1 unit; a prime term turns the pencil 90 degrees to the right, then advances 1 unit.
The same spiral is achieved when reading one by one the nonprime/prime digits of the sequence (instead of the terms) and using the pencil accordingly.
This is possible as the terms of the sequence were carefully chosen to place a prime term (respectively, a prime digit) at every corner of the spiral (and nowhere else).
EXAMPLE
The pencil points towards the East before the start. The 0 doesn't change its orientation and a 1-unit line directed towards the East is traced. As 2 is prime, the pencil turns 90 degrees towards the South and a 1-unit line is traced. As 3 is prime, the pencil turns 90 degrees towards the West and a 1-unit line is traced. As 1 is nonprime, the pencil doesn't change its orientation (towards the West) and a 1-unit line is traced. As 5 is prime, the pencil turns 90 degrees towards the North and a 1-unit line is traced. As 4 is nonprime, the pencil doesn't change its orientation (towards the North) and a 1-unit line is traced. Etc.
When it comes to a(10) = 29, the "term-only-pencil" reads 29 (prime), changes its orientation (by making a right turn) and advances 1 square, then reads a(11) = 9 (nonprime), doesn't change its orientation and advances 1 square;
Similarly, when it comes to a(10) = 29, the "digits-only-pencil" reads the digit 2 (prime), changes its orientation (by making a right turn) and advances 1 square, then reads the digit 9 (nonprime), doesn't change its orientation and advances 1 square;
Those two behaviors of the pencils are equivalent when it comes to draw the clockwise square spiral.
CROSSREFS
Cf. A344547, A344548, A174344 (an example of a clockwise square spiral).
Sequence in context: A335423 A345011 A345012 * A114690 A336364 A294223
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Jun 09 2021
STATUS
approved