login
On a square lattice, repeatedly write down the smallest positive number that has not yet been used, starting with the least significant digit. Write one digit per point, skipping lattice points already labeled. Move one point further regardless of content, and rotate the movement direction 90 degrees clockwise. Read the smallest number created, ignoring leading zeros and starting with the least significant digit: a(n) gives the n-th number.
1

%I #57 Dec 04 2014 17:07:03

%S 1,2,3,4,21,5,6,23,7,8,25,11,9,70,12,10,90,270,43,100,1090,13,50,72,

%T 310,14,500,1072,15,16,9013,20,17,7015,1012,18,19,10010,22,24,26,210,

%U 27,40,32,721,28,400,132,29,71,322,402,33,220,232

%N On a square lattice, repeatedly write down the smallest positive number that has not yet been used, starting with the least significant digit. Write one digit per point, skipping lattice points already labeled. Move one point further regardless of content, and rotate the movement direction 90 degrees clockwise. Read the smallest number created, ignoring leading zeros and starting with the least significant digit: a(n) gives the n-th number.

%C Is this a permutation of the natural numbers?

%C Will every point be visited?

%C Does every row/column contain every digit? - _Jon Perry_, Oct 31 2014

%C From _Jon E. Schoenfield_, Nov 11 2014: (Start)

%C << step 4, why not 14? >>

%C 4 hasn't been used yet, and is smaller than 14, and we don't have to make a(4) a 2-digit number, so a(4) is 4 (and the position is then advanced to (0,0), where the '1' has already been written.)

%C << why does the pink blob sometimes land on a number, other times not? >>

%C The pink blob is always placed one lattice point beyond the last (i.e., most significant) digit used in building the most recent term of the sequence. Sometimes building a number that hasn't yet been used requires using more than one digit (sometimes more than 2 digits, etc.), sometimes it doesn't. We go only as far as required to obtain a number that hasn't yet been included in the sequence.

%C << step 20 only adds 0? >>

%C By that step, the numbers 1 through 9 are already in the sequence, so we can't just write one digit at the current location (i.e., (-1,1)) and say it's a(20); a(20) will have to be more than one digit long. But it can't be a two-digit number, because (given the '0' already written at (-1,0)) that would make it a two-digit number with a leading zero, and leading zeros (per the sequence's Name) are disregarded. So it'll have to be at least a 3-digit number. With the already-written '1' at (-1,1), a(20) (if it's a 3-digit number) would be something in the interval [100,109]; those are all available, so we make a(20) the smallest number in that interval, 100, by writing a '0' digit at the current location (-1,-1) (and using it and the next two digits in the upward direction to build a(20)=100).

%C << why do we add 1 at step 35? >>

%C When step 34 is completed, we're located at (1,0), and will need to move toward the left to build a(35). There's already a '2' at (1,0), and 2 is already in the sequence, so we'll need at least one more digit. Moving one lattice point toward the left, we reach the already-written '1' at (0,0), but 12 is already in the sequence, so we can't stop there; we'll need at least one more digit. Moving one lattice point farther toward the left, we reach the already-written '0' at (-1,0), but we can't stop there, either, because (since leading zeros are ignored) we'd be using the 3-digit number '012', i.e., 12 (already used). So we move one more lattice point to the left, and finally reach an empty lattice point. We can't write a '0' there and stop (since leading zeros are ignored), but if we write a '0' there and keep going, then a(35) will have to be at least a 5-digit number (10012), but there are 4-digit numbers available: 'd012', where 'd' is any digit from '1' through '9'. So we use the smallest of those, to get the smallest unused number that ends with '012', i.e., a(35)=1012.

%C << step 39, we add 22 because we already have 21? >>

%C Yes; by step 39, all integers less than 22 are already in the sequence.

%C << step 48, why add 0? >>

%C All 1-digit numbers are already in the sequence; we can't use a 2-digit number here, because it would have a leading zero (already written at (-3,-4)), so we'll have to use at least a 3-digit number. If it's a 3-digit number it'll be '40d', i.e., a number in the range [400,409]; the smallest of those, 400, is not yet in the sequence, so write a '0' and use the '0' above it and the '4' above that to build a(39)=400.

%C (End)

%H Paul Tek, <a href="/A246391/b246391.txt">Table of n, a(n) for n = 1..10000</a>

%H Paul Tek, <a href="/A246391/a246391.pl.txt">Perl program for this sequence</a>

%H Paul Tek, <a href="/A246391/a246391.txt">Lattice with digits written down during the first 10000 steps</a>

%H Paul Tek, <a href="/A246391/a246391.png">Colorful representation of the direction of first visit during the first 100000 steps</a>

%H Paul Tek, <a href="/A246391/a246391.pdf">Illustration of the first terms</a>

%e See Links section.

%o (Perl) See Links section.

%Y Cf. A224876.

%K nonn,base

%O 1,2

%A _Paul Tek_, Sep 21 2014