A165305 a(n) is the smallest number not yet in the sequence such that the concatenation of all terms yields a periodic stream of digits 1, 2, 3, ..., 7 (repeat from 1).
1, 2, 3, 4, 5, 6, 7, 12, 34, 56, 71, 23, 45, 67, 123, 456, 712, 345, 671, 234, 567, 1234, 5671, 2345, 6712, 3456, 7123, 4567, 12345, 67123, 45671, 23456, 71234, 56712, 34567, 123456, 712345, 671234, 567123, 456712, 345671, 234567, 1234567
Offset: 1
Examples
For a(8), having already 1, 2, 3, 4, 5, 6, 7, the next number must be 12 because after 1,2,3,4,5,6,7 we shall continue with a 1. But 1 is already in the sequence so we need to add a 2 -> 12. And so on.
Extensions
Keyword base added by R. J. Mathar, Feb 02 2010