login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A269631
a(1) = 0; a(n+1) is the smallest integer not yet used that contains the number of decimal digits of a(n) as a substring.
1
0, 1, 10, 2, 11, 12, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 42, 52, 62, 72, 82, 92, 102, 3, 13, 112, 30, 120, 31, 121, 33, 122, 34, 123, 35, 124, 36, 125, 37, 126, 38, 127, 39, 128, 43, 129, 53, 132, 63, 142, 73, 152, 83, 162, 93, 172, 103, 113, 130, 131, 133, 134, 135
OFFSET
1,3
COMMENTS
Conjecture: a(n) is a permutation of the nonnegative integers.
The following table shows:
C = number of terms calculated
F = number of terms less than C
+------------+----------+-----------+
| C | F | % |
+------------+----------+------------
| 10 | 2 | 20.0 |
| 100 | 39 | 39.0 |
| 1000 | 532 | 53.2 |
| 10000 | 6379 | 63.79 |
| 100000 | 71609 | 71.609 |
| 1000000 | 765630 | 76.563 |
| 10000000 | 7907944 | 79.07944 |
| 100000000 | 81251152 | 81.251152 |
.
and the growth of percentage seems to support the conjecture.
LINKS
EXAMPLE
a(2) = 1 because a(1) = 0 and 0 has 1 decimal digit;
a(3) = 10 because a(2) = 1, so 1 has 1 digit, and 10 is the first integer not yet used that contains "1";
a(4) = 2 because a(3) = 10 and 10 has 2 digits;
a(5) = 11 because a(4) = 2, so 2 has 1 digit, and 11 is the first integer not yet used that contains "1"; ...
MATHEMATICA
a = {0, 1}; Do[AppendTo[a, SelectFirst[Range[10^3], And[! MemberQ[a, #], MemberQ[IntegerDigits@ #, IntegerLength@ a[[n - 1]]]] &]], {n, 3, 64}]; a (* Michael De Vlieger, Apr 01 2016 *)
PROG
(Python)
# This routine is a little bit more complex compared to the same with
# the a(n) terms 'storage' (now we memorize only the highest number
# for every k-digits) but is very much faster.
print("0", end=', ')
lista = [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
a = 1
for g in range (1, 100):
b = len(str(a))
val = lista[b] + 1
flag = 0
while flag == 0:
sval = str(val)
while str(b) not in sval:
val += 1
sval = str(val)
k = len(sval)
comp = k
for s in range(k):
if lista[int(sval[s])] < val:
comp -= 1
if comp == 0:
flag = 1
else:
val +=1
print(val, end=', ')
lista[b] = val
a = val
# Francesco Di Matteo, Mar 02 2016
(PARI) findnew(nbd, vsa) = {k=0; while (vecsearch(vsa, k) || !vecsearch(vecsort(digits(k)), nbd), k++); k; }
listd(nn) = {va = vector(nn); print1(va[1], ", "); vsa = vecsort(va, , 8); for (n=2, nn, nbd = #Str(va[n-1]); na = findnew(nbd, vsa); print1(na, ", "); va[n] = na; vsa = vecsort(va, , 8); ); } \\ Michel Marcus, Mar 08 2016
CROSSREFS
Sequence in context: A351840 A257277 A248024 * A334737 A334837 A327689
KEYWORD
nonn,base
AUTHOR
Francesco Di Matteo, Mar 01 2016
STATUS
approved