%I #13 Jul 23 2019 03:00:15
%S 0,1,3,2,5,4,6,3,7,6,8,5,10,7,9,4,9,8,10,7,12,9,11,6,14,11,13,8,15,10,
%T 12,5,11,10,12,9,14,11,13,8,16,13,15,10,17,12,14,7,18,15,17,12,19,14,
%U 16,9,21,16,18,11,20,13,15,6,13,12,14,11,16,13,15,10,18,15,17,12,19,14,16,9,20,17,19,14,21,16,18,11,23,18,20,13,22,15,17,8,22,19,21,16,23
%N Number of iterations of A326729(x) starting at x = n to reach 0.
%C The sequence is well-defined, see Problem 5 of IMO 2019.
%H International Mathematical Olympiad, <a href="https://www.imo-official.org/problems.aspx">Problem 5 of IMO 2019</a>.
%H Rémy Sigrist, <a href="/A326730/a326730.png">Scatterplot of the ordinal transform of the first 2^16 terms</a>
%F a(n) = 2*A029931(n) - A000120(n)^2.
%o (PARI) A326730(n) = my(b=Vecrev(binary(n)), m=vecsum(b)); 2*sum(i=1,#b,i*b[i]) - m^2;
%Y Cf. A000120, A326729, A326731, A326732.
%K base,nonn
%O 0,3
%A _Max Alekseyev_, Jul 22 2019