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.
%I A258822 #12 Nov 06 2023 11:07:48 %S A258822 0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0, %T A258822 0,0,0,0,0,0,1,0,1,1,1,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0, %U A258822 0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0 %N A258822 Number of times that k iterations of n under the '3x+1' map yield k for some k. %C A258822 This sequence uses the definition in A006370: if n is odd, n -> 3*n+1, if n is even, n -> n/2. %C A258822 The number 3 appears first at a(63105). Do all nonnegative numbers appear? See A258824. %H A258822 Paolo Xausa, <a href="/A258822/b258822.txt">Table of n, a(n) for n = 1..10000</a> %H A258822 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %e A258822 For n = 6, the '3x+1' map is as follows: 6 -> 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. Here the number of iterations is 8. However, after the k-th iteration, the result does not equal k. Thus a(6) = 0. %e A258822 For n = 7, the '3x+1' map is as follows: 7 -> 22 -> 11 -> 34 -> 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. Only after 10 iterations do we arrive at 10. Since this is the only time this happens, a(7) = 1. %t A258822 A258822[n_]:=Count[MapIndexed[{#1}==#2-1&,NestWhileList[If[OddQ[#],3#+1,#/2]&,n,#>1&]],True];Array[A258822,100] (* _Paolo Xausa_, Nov 06 2023 *) %o A258822 (PARI) Tvect(n)=v=[n]; while(n!=1, if(n%2, k=(3*n+1); v=concat(v, k); n=k); if(!(n%2), k=n/2; v=concat(v, k); n=k)); v %o A258822 for(n=1, 200, d=Tvect(n); c=0; for(i=1, #d, if(d[i]==i-1, c++)); print1(c, ", ")) %Y A258822 Cf. A006370, A258772, A070165. %K A258822 nonn %O A258822 1,24 %A A258822 _Derek Orr_, Jun 11 2015