OFFSET
1,2
COMMENTS
Empirical observations:
The sequence is not sensitive to the initial value; sooner or later the sequence arrives at 21 and has the same trajectory thereafter.
Certain numbers cannot appear more than once. An example is 210, since it signifies a(n) was the 10th instance of a 2-digit number. We cannot ever say that a 21-digit number has appeared 0 times. However, 211 may signify a(n) was the 11th instance of a 2-digit number, or the first instance of a 21-digit number. It is difficult to ascertain the structure of repetitions, when they occur, etc.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Log log scatterplot of a(n) for n = 1..2^20.
EXAMPLE
a(1) = 0.
a(2) = 11 since 0 is the first instance of a 1-digit number in the sequence,
a(3) = 21 since 11 is the first instance of a 2-digit number,
a(4) = 22 since 21 is the second instance of a 2-digit number, ...
a(12) = 210 since 29 is the tenth instance of a 2-digit number,
a(13) = 31 since 210 is the first instance of a 3-digit number, etc.
a(1) can be any positive integer number between 0-9, the sequence will not have further change. The overall sequence is defined by the number of digits of a(1).
For example if a(1) were 1000000000 or 9999999999, then we would have a(2)=101, a(3)=31, a(4)=21, a(5)=22, ... where a(1) has 10 digits so a(2) would start with 10 and ends with 1, etc.
MATHEMATICA
iL[n_] := IntegerLength[n] + Boole[n==0]; a[1]=0; a[n_] := a[n] = Block[{t = iL@ a[n-1]}, FromDigits[ Join @@ IntegerDigits@ {t, Count[iL /@ Array[a, n - 1], t]}]]; Array[a, 56] (* Giovanni Resta, Sep 16 2019 *)
(* Fast program memoizing the number of instances of a given integer length: *)
c[_] = j = 0; c[0] = 1; {0}~Join~Reap[Do[(c[#]++; Set[k, #*10^IntegerLength[c[#]] + c[#]]) &[Boole[j == 0] + IntegerLength[j]]; Sow[k]; j = k, {i, 10^4}]][[-1, -1]] (* Michael De Vlieger, Dec 23 2021 *)
PROG
(MATLAB)
length_of_sequence=2000;
sequence=zeros(1, length_of_sequence); %allocation for the sequence
sequence(1)=11; %start from a(2)=11
for i=1:1:(length_of_sequence-1)
first=numel(num2str(sequence(1, i))); %defining the first string
second=0;
for index = 1:size(sequence, 2)
if numel(num2str(sequence(index)))==first
second=second+1; %defining the second string
end
end
s = strcat(num2str(first), num2str(second)); %building a(n+1)
sequence(i+1)=str2double(s); %placing the value into a(n+1)
end
result_sequence=transpose(sequence);
(PARI) lista(nn) = {my(va = vector(nn)); va[1] = 0; for (n=2, nn, my(nba = #Str(va[n-1])); my(vn = vector(n-1, k, va[k])); my(nbb = #select(x->(#Str(x)==nba), vn)); va[n] = eval(concat(Str(nba), Str(nbb))); ); va; } \\ Michel Marcus, Sep 16 2019
(Python)
from itertools import islice
from collections import Counter
def agen(): # generator of terms
an, c = 0, Counter()
while True:
yield an
d = len(str(an))
c[d] += 1
an = int(str(d) + str(c[d]))
print(list(islice(agen(), 60))) # Michael S. Branicky, Nov 12 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bence BernĂ¡th, Sep 14 2019
STATUS
approved