

A316774


a(n) = n for n < 2, a(n) = freq(a(n1),n) + freq(a(n2),n) for n >= 2, where freq(i,j) is the number of times i appears in [a(0),a(1),...,a(j1)].


18



0, 1, 2, 2, 4, 3, 2, 4, 5, 3, 3, 6, 4, 4, 8, 5, 3, 6, 6, 6, 8, 6, 7, 6, 7, 8, 5, 6, 10, 8, 5, 8, 9, 6, 9, 10, 4, 7, 8, 9, 9, 8, 11, 8, 9, 13, 6, 10, 12, 4, 7, 10, 8, 13, 11, 4, 9, 13, 9, 10, 12, 7, 7, 12, 9, 11, 11, 8, 14, 11, 6, 15, 11, 7, 13, 11, 11, 16, 9, 10
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

In other words, a(n) = (number of times a(n1) has appeared) plus (number of times a(n2) has appeared).  N. J. A. Sloane, Dec 13 2019
What is the asymptotic behavior of this sequence?
Does it contain every positive integer at least once?
Does it contain every positive integer at most finitely many times?
Additional comments from Peter Illig's "Puzzles" link below (Start):
Sometimes referred to as "The Devil's Sequence" (by me), due to the early presence of three consecutive 6's (and my inability to understand it). The next time a number occurs three times in a row isn't until a(355677).
If each n does appear only finitely many times, approximately how many times does it appear? (It seems to be close to 2n.)
What are the best possible upper/lower bounds on a(n)?
Let r(k) be the smallest n such that {0,1,2,...,k} is contained in {a(0),...,a(n)}. What is the asymptotic behavior of r(k)? (It seems to be close to k^2/2.)
(End)


LINKS

Alois P. Heinz, Table of n, a(n) for n = 0..65536
"Horseshoe_Crab" Reddit User, Properties of a Strange, Rather Meta Sequence. [In case this link breaks, the main point of the discussion is to propose the sequence and suggest other initial values.  N. J. A. Sloane, Dec 13 2019]
Peter Illig, Problems. [No date, probably 2018]
Samuel B. Reid, Density plot of one billion terms
Rémy Sigrist, Density plot of the first 10000000 terms


EXAMPLE

For n=4, a(n1) = a(n2) = 2, and 2 appears twice in the first 4 terms. So a(4) = 2 + 2 = 4.


MAPLE

b:= proc() 0 end:
a:= proc(n) option remember; local t;
t:= `if`(n<2, n, b(a(n1))+b(a(n2)));
b(t):= b(t)+1; t
end:
seq(a(n), n=0..200); # Alois P. Heinz, Jul 12 2018


MATHEMATICA

a = prev = {0, 1};
Do[
AppendTo[prev, Count[a, prev[[1]]] + Count[a, prev[[2]]]];
AppendTo[a, prev[[3]]];
prev = prev[[2 ;; ]] , {78}]
a (* Peter Illig, Jul 12 2018 *)


CROSSREFS

Cf. A001462, A316973 (freq(n)), A316905 (when n appears), A316984 (when n last appears), A330439 (total number of times a(n) has appeared so far).
For records see A330330, A330331.
See A306246 and A329934 for similar sequences with different initial conditions.
A330332 considers the frequencies of the three previous terms.
Sequence in context: A161003 A152028 A244318 * A333920 A246815 A246836
Adjacent sequences: A316771 A316772 A316773 * A316775 A316776 A316777


KEYWORD

nonn,look


AUTHOR

Peter Illig, Jul 12 2018


EXTENSIONS

Definition clarified by N. J. A. Sloane, Dec 13 2019


STATUS

approved



