login
A246391
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
1, 2, 3, 4, 21, 5, 6, 23, 7, 8, 25, 11, 9, 70, 12, 10, 90, 270, 43, 100, 1090, 13, 50, 72, 310, 14, 500, 1072, 15, 16, 9013, 20, 17, 7015, 1012, 18, 19, 10010, 22, 24, 26, 210, 27, 40, 32, 721, 28, 400, 132, 29, 71, 322, 402, 33, 220, 232
OFFSET
1,2
COMMENTS
Is this a permutation of the natural numbers?
Will every point be visited?
Does every row/column contain every digit? - Jon Perry, Oct 31 2014
From Jon E. Schoenfield, Nov 11 2014: (Start)
<< step 4, why not 14? >>
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.)
<< why does the pink blob sometimes land on a number, other times not? >>
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.
<< step 20 only adds 0? >>
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).
<< why do we add 1 at step 35? >>
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.
<< step 39, we add 22 because we already have 21? >>
Yes; by step 39, all integers less than 22 are already in the sequence.
<< step 48, why add 0? >>
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.
(End)
EXAMPLE
See Links section.
PROG
(Perl) See Links section.
CROSSREFS
Cf. A224876.
Sequence in context: A012287 A012575 A012580 * A303973 A225466 A225472
KEYWORD
nonn,base
AUTHOR
Paul Tek, Sep 21 2014
STATUS
approved