%I
%S 1,1,2,1,3,2,3,4,4,5,5,6,6,7,7,8,8,9,10,11,9,12,13,10,14,15,16,17,11,
%T 12,18,19,13,14,20,21,22,23,15,24,25,26,27,28,29,16,30,31,17,18,32,33,
%U 34,35,36,37,19,20,38,39,40,41,21,42,43,22,44,45,46,47,23,24,48,49,50,51
%N a(n+1) = if a(n) is prime then (number of primes so far) else (number of nonprimes so far), a(1) = 1.
%C All terms greater than 1 occur exactly twice: a(A137662(n)) = a(n).
%H R. Zumkeller, <a href="/A137661/b137661.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n+1) = A005171(a(n))*Sum(A005171(a(k)):1<=k<=n) + A010051(a(n))*Sum(A010051(a(k)):1<=k<=n).
%K nonn
%O 1,3
%A _Reinhard Zumkeller_, Feb 04 2008
