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
Francesco Di Matteo, Table of n, a(n) for n = 1..1000
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
KEYWORD
nonn,base
AUTHOR
Francesco Di Matteo, Mar 01 2016
STATUS
approved