cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A350278 Index of first occurrence of n in A349325.

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