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.

A258772 Number of fixed points in the Collatz (3x+1) trajectory of n.

This page as a plain text file.
%I A258772 #18 Nov 06 2023 11:07:53
%S A258772 1,0,0,1,1,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,1,0,
%T A258772 0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,
%U A258772 0,0,0,1,0,1,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
%N A258772 Number of fixed points in the Collatz (3x+1) trajectory of n.
%C A258772 This sequence uses the definition in A006370: if n is odd, n -> 3n+1 and if n is even, n -> n/2.
%C A258772 The number 3 appears first at a(187561). Do all nonnegative numbers appear? See A258821.
%H A258772 Paolo Xausa, <a href="/A258772/b258772.txt">Table of n, a(n) for n = 1..10000</a>
%H A258772 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%e A258772 For n = 5, the trajectory is T(5) = [5, 16, 8, 4, 2, 1]. Since the fourth term in this sequence is 4, this is a fixed point. Since there is only one fixed point, a(5) = 1.
%e A258772 For n = 6, the trajectory is T(6) = [6, 3, 10, 5, 16, 8, 4, 2, 1]. Here, the k-th term in this trajectory does not equal k for any possible k. So a(6) = 0.
%t A258772 A258772[n_]:=Count[MapIndexed[{#1}==#2&,NestWhileList[If[OddQ[#],3#+1,#/2]&,n,#>1&]],True];Array[A258772,100] (* _Paolo Xausa_, Nov 06 2023 *)
%o A258772 (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 A258772 for(n=1,200,d=Tvect(n);c=0;for(i=1,#d,if(d[i]==i,c++));print1(c,", "))
%Y A258772 Cf. A006370, A070165.
%K A258772 nonn
%O A258772 1,12
%A A258772 _Derek Orr_, Jun 09 2015