%I #26 Jan 10 2022 13:41:27
%S 1,3,6,7,14,19,54,109,110,73,146,145,328,129,342,345,398,337,462,313,
%T 3708,353,470,14673,5838,10855,23718,14473,60216,26283,60220,60221,
%U 500726,155897,1098404,445089,1098406,1316099,1168014,1386505,3932646,1169865,4424230
%N Index of first occurrence of n in A349325.
%H Chai Wah Wu, <a href="/A350278/b350278.txt">Table of n, a(n) for n = 1..82</a>
%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%e a(5) = 14 because 5 occurs for the first time at position 14 in A349325.
%t A349325[n_]:=A349325[n]=Module[{h=1,c=n,prevc=n},While[c>1,If[OddQ[c],c=(3c+1)/2;If[prevc<n&&c>n,h++],c/=2^IntegerExponent[c,2];If[prevc>n&&c<n,h++]];prevc=c];h]
%t nterms=30;Table[i=0;While[A349325[++i]!=n];i,{n,nterms}]
%o (Python)
%o def A349325(n):
%o prevc = c = n
%o h = 1
%o while c > 1:
%o if c % 2:
%o c = (3*c+1) // 2
%o if prevc < n and c > n: h += 1
%o else:
%o c //= 2
%o if prevc > n and c < n: h += 1
%o prevc = c
%o return h
%o def A349325_fo_idx(n):
%o i = 1
%o while A349325(i) != n:
%o i += 1
%o return i
%o print([A349325_fo_idx(n) for n in range(1, 20)])
%Y Cf. A349325, A350277.
%K nonn,hard
%O 1,2
%A _Paolo Xausa_, Dec 22 2021
%E a(36)-a(43) from _Chai Wah Wu_, Jan 04 2022
|