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.

A258825 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)), ...

This page as a plain text file.
%I A258825 #15 Nov 06 2023 07:15:29
%S A258825 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 A258825 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 A258825 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 A258825 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 A258825 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 A258825 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 A258825 2 occurs first at a(105) and 3 occurs first at a(305). Do all nonnegative numbers appear? See A258828.
%H A258825 Antti Karttunen, <a href="/A258825/b258825.txt">Table of n, a(n) for n = 1..10000</a>
%H A258825 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%e A258825 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 A258825 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 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 A258825 (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 A258825 for(n=1, 200, d=Tvect(n); c=0; for(i=1, #d, if(d[i]==i-1, c++)); print1(c, ", "))
%o A258825 (Scheme)
%o A258825 (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 A258825 (define (A014682 n) (if (even? n) (/ n 2) (/ (+ n n n 1) 2)))
%o A258825 ;; _Antti Karttunen_, Aug 18 2017
%Y A258825 Cf. A258769 (variant where the indexing starts from k=1), A014682, A070168.
%K A258825 nonn
%O A258825 1,105
%A A258825 _Derek Orr_, Jun 11 2015
%E A258825 Name changed by _Antti Karttunen_, Aug 18 2017