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.

Showing 1-1 of 1 results.

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

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Derek Orr, Jun 11 2015

Keywords

Comments

Number of times that k iterations of n under the modified Collatz function yield k for some k. - The original name of the sequence.
This sequence uses the definition given in A014682: if n is odd, n -> (3n+1)/2 and if n is even, n -> n/2.
2 occurs first at a(105) and 3 occurs first at a(305). Do all nonnegative numbers appear? See A258828.

Examples

			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.
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.
		

Crossrefs

Cf. A258769 (variant where the indexing starts from k=1), A014682, A070168.

Programs

  • Mathematica
    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 *)
  • 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
    for(n=1, 200, d=Tvect(n); c=0; for(i=1, #d, if(d[i]==i-1, c++)); print1(c, ", "))
    
  • Scheme
    (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))))))
    (define (A014682 n) (if (even? n) (/ n 2) (/ (+ n n n 1) 2)))
    ;; Antti Karttunen, Aug 18 2017

Extensions

Name changed by Antti Karttunen, Aug 18 2017
Showing 1-1 of 1 results.