login
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).
1

%I #6 Jun 05 2021 17:03:39

%S 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,

%T 30,46,48,13,49,60,61,31,64,66,68,34,69,80,81,36,84,86,88,15,89,90,91,

%U 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

%N 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).

%C 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.

%e 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.

%e 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.

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

%K base,nonn

%O 1,2

%A _Eric Angelini_ and _Carole Dubois_, Jun 05 2021