cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A345012 Lexicographically earliest sequence of nonnegative terms forming a clockwise square spiral when nothing else is read except the nonprime/prime nature of the digits (see the Comments section).

Original entry on oeis.org

0, 2, 3, 1, 5, 4, 7, 6, 8, 20, 9, 21, 10, 24, 11, 26, 14, 12, 16, 18, 28, 19, 40, 29, 41, 44, 30, 46, 48, 13, 49, 60, 61, 31, 64, 66, 68, 34, 69, 80, 81, 36, 84, 86, 88, 15, 89, 90, 91, 94, 38, 96, 98, 99, 102, 100, 101, 104, 39, 106, 108, 109, 50, 110, 111, 114, 51, 116, 118, 119, 17, 140, 141, 144, 103
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Jun 05 2021

Keywords

Comments

A nonprime digit turns the pencil 0 degrees to the right, then advances 1 unit; a prime digit turns the pencil 90 degrees to the right, then advances 1 unit.

Examples

			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) = 20, the pencil reads 2 (prime), turns to the right and advances 1 square, then reads 0 (nonprime), doesn't change its orientation and advances 1 square again. Etc.
		

Crossrefs

Cf. A345011 (same idea with nonprime/prime terms), A344548 (same idea with even/odd digits), A174344 (an example of a clockwise square spiral).