login
A258769
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 1st term: n, A014682(n), A014682(A014682(n)), ...
4
1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0
OFFSET
1
COMMENTS
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(156) and 3 occurs first at a(153). Do all nonnegative numbers appear? See A258819.
"Number of fixed points in the modified Collatz trajectory of n." - This was the original name of the sequence, but is slightly misleading. - Antti Karttunen, Aug 18 2017
EXAMPLE
For n = 6, the trajectory is given by T(6) = [6, 3, 5, 8, 4, 2, 1]. There are no values here such that T(6)[i] = i. So there are no fixed points, meaning a(6) = 0.
For n = 10, the trajectory is given by T(10) = [10, 5, 8, 4, 2, 1]. Here, the fourth term is 4, so there is a fixed point. Since there is only one, a(10) = 1.
MATHEMATICA
A258769[n_]:=Count[MapIndexed[{#1}==#2&, NestWhileList[If[OddQ[#], (3#+1)/2, #/2]&, n, #>1&]], True]; Array[A258769, 100] (* Paolo Xausa, Nov 06 2023 *)
PROG
(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, c++)); print1(c, ", "))
(Scheme)
(define (A258769 n) (if (= 1 n) n (let loop ((n n) (i 1) (s 0)) (if (= 1 n) s (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
CROSSREFS
Cf. A014682, A070168, A258819, A258825 (variant where the indexing starts from k=0).
Sequence in context: A231367 A113428 A133101 * A266377 A266326 A185295
KEYWORD
nonn
AUTHOR
Derek Orr, Jun 09 2015
EXTENSIONS
Name changed by Antti Karttunen, Aug 18 2017
STATUS
approved