OFFSET
1,2
COMMENTS
Essentially the same as A281665. - R. J. Mathar, Feb 07 2020
Steps after reaching 1 the first time are ignored. For example, for 5, 16, 8, 4, 2, 1, 4, 2, 1, ..., only 8, 4, 2, 1 are counted for halving steps, the subsequent 4, 2, 1 subcycles are ignored.
LINKS
Gus Michel, Table of n, a(n) for n = 1..2000
EXAMPLE
159 is in the sequence because its trajectory, 159, 478, 239, 718, ..., has 36 halving steps and 18 tripling steps.
160 is not in the sequence because its trajectory, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1, has nine even terms but only two odd terms.
MATHEMATICA
collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 50; t = {}; n = 0; While[Length[t] < nn, n++; c = collatz[n]; ev = Length[Select[c, EvenQ]]; od = Length[c] - ev - 1; If[ev == 2 * od, AppendTo[t, n]]]; t
PROG
(Scala) def halfTripleCompare(n: Int): Int = {
var curr = n
var htc = 0
while (curr > 1) {
curr = (curr % 2) match {
case 0 => htc = htc + 1
curr / 2
case 1 => htc = htc - 2
3 * curr + 1
}
}
htc
}
(1 to 1000).filter(halfTripleCompare(_) == 0) // Alonso del Arte, Nov 18 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Nov 16 2019
STATUS
approved
