Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #15 Nov 06 2023 07:15:29
%S 0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
%T 0,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,
%U 1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,2,0,0
%N a(n) = Number of times the k-th term is equal to k in the modified Collatz trajectory of n, when counting the initial term n as the term zero: n, A014682(n), A014682(A014682(n)), ...
%C Number of times that k iterations of n under the modified Collatz function yield k for some k. - The original name of the sequence.
%C This sequence uses the definition given in A014682: if n is odd, n -> (3n+1)/2 and if n is even, n -> n/2.
%C 2 occurs first at a(105) and 3 occurs first at a(305). Do all nonnegative numbers appear? See A258828.
%H Antti Karttunen, <a href="/A258825/b258825.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%e For n = 5, the Collatz function does the following: 5 -> 8 -> 4 -> 2 -> 1. Here, for k = 1, 2, 3, 4, applying k iterations to 5 does not yield k. So a(5) = 0.
%e For n = 6, the Collatz function does the following: 6 -> 3 -> 5 -> 8 -> 4 -> 2 -> 1. After the 4th iteration, you arrive at 4. Since this is the only time this occurs, a(6) = 1.
%t A258825[n_]:=Count[MapIndexed[{#1}==#2-1&,NestWhileList[If[OddQ[#],(3#+1)/2,#/2]&,n,#>1&]],True];Array[A258825,100] (* _Paolo Xausa_, Nov 06 2023 *)
%o (PARI) Tvect(n)=v=[n]; while(n!=1, if(n%2, k=(3*n+1)/2; v=concat(v, k); n=k); if(!(n%2), k=n/2; v=concat(v, k); n=k)); v
%o for(n=1, 200, d=Tvect(n); c=0; for(i=1, #d, if(d[i]==i-1, c++)); print1(c, ", "))
%o (Scheme)
%o (define (A258825 n) (let loop ((n n) (i 0) (s 0)) (if (= 1 n) (+ s (if (= i 1) 1 0)) (loop (A014682 n) (+ 1 i) (+ s (if (= i n) 1 0))))))
%o (define (A014682 n) (if (even? n) (/ n 2) (/ (+ n n n 1) 2)))
%o ;; _Antti Karttunen_, Aug 18 2017
%Y Cf. A258769 (variant where the indexing starts from k=1), A014682, A070168.
%K nonn
%O 1,105
%A _Derek Orr_, Jun 11 2015
%E Name changed by _Antti Karttunen_, Aug 18 2017