%I #31 Apr 09 2023 02:05:27
%S 1,1,2,1,3,2,3,4,1,4,2,5,6,3,7,8,1,5,9,4,5,10,6,7,11,12,2,13,14,8,3,
%T 15,9,10,11,16,1,6,12,4,13,17,18,5,19,20,6,14,15,16,2,21,17,22,18,7,
%U 23,24,3,25,19,26,20,8,9,21,22,23,27,10,24,4,25,26,27,11,28,12,13,29,30,14,28
%N a(1) = 1; for n > 1, a(n) is number of terms in the first n-1 terms of the sequence that have the same number of prime factors, counted with multiplicity, as a(n-1).
%C After 1 million terms the most common numbers for the number of prime factors of the terms are 3, 2, 4, and 5. These correspond to the uppermost four lines of the attached image. It is unknown if these stay the most common or are passed by numbers with more prime factor as n gets arbitrarily large.
%C See A362033 for the indices where a(n) = 1.
%H Michael De Vlieger, <a href="/A362031/b362031.txt">Table of n, a(n) for n = 1..10000</a>
%H Michael De Vlieger, <a href="/A362031/a362031_1.png">Log log scatterplot of a(n)</a>, n = 1..2^16, with a color function representing Omega(a(n-1)), where black = 0, red = 1, orange = 2, ..., magenta = 14.
%H Scott R. Shannon, <a href="/A362031/a362031.png">Image of the first 1 million terms</a>.
%e a(6) = 2 as the number of prime factors of a(5) = A001222(a(5)) = A001222(3) = 1, and there are two previous terms, a(3) and a(5), that have one prime factor.
%e a(9) = 1 as the number of prime factors of a(8) = A001222(a(8)) = A001222(4) = 2, and there is only one term, a(8), that has two prime factors.
%t nn = 120; c[_] = 0; j = a[1] = c[0] = 1; m = 0; Do[Set[k, c[m]]; (Set[{a[n], j, m}, {k, k, #}]; c[#]++) &[PrimeOmega[k]], {n, 2, nn}]; Array[a, nn] (* _Michael De Vlieger_, Apr 06 2023 *)
%o (Python)
%o from sympy import factorint
%o from itertools import islice
%o from collections import Counter
%o def A362031gen(): # generator of terms
%o an, c, d = 1, Counter(), dict()
%o while True:
%o yield an
%o pf = d[an] if an in d else sum(factorint(an).values())
%o c[pf] += 1
%o an = c[pf]
%o print(list(islice(A362031gen(), 83))) # _Michael S. Branicky_, Apr 06 2023
%o (Python)
%o from itertools import islice
%o from sympy import primeomega
%o def A362031_gen(): # generator of terms
%o a, b, c = {}, {}, 1
%o while True:
%o yield c
%o d = b[c] = b.get(c,primeomega(c))
%o c = a[d] = a.get(d,0)+1
%o A362031_list = list(islice(A362031_gen(),20)) # _Chai Wah Wu_, Apr 08 2023
%Y Cf. A362033, A001222, A354606, A000005, A124056, A342585.
%K nonn
%O 1,3
%A _Scott R. Shannon_, Apr 06 2023