login

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

A062052
Numbers with 2 odd integers in their Collatz (or 3x+1) trajectory.
15
5, 10, 20, 21, 40, 42, 80, 84, 85, 160, 168, 170, 320, 336, 340, 341, 640, 672, 680, 682, 1280, 1344, 1360, 1364, 1365, 2560, 2688, 2720, 2728, 2730, 5120, 5376, 5440, 5456, 5460, 5461, 10240, 10752, 10880, 10912, 10920, 10922, 20480, 21504, 21760, 21824
OFFSET
1,1
COMMENTS
The Collatz (or 3x+1) function is f(x) = x/2 if x is even, 3x+1 if x is odd.
The Collatz trajectory of n is obtained by applying f repeatedly to n until 1 is reached.
The sequence consists of terms of A002450 and their 2^k multiples. The first odd integer in the trajectory is one of the terms of A002450 and the second odd one is the terminal 1. - Antti Karttunen, Feb 21 2006
This sequence looks to appear first in the literature on page 1285 in R. E. Crandall.
LINKS
Reinhard Zumkeller and T. D. Noe, Table of n, a(n) for n = 1..1000 (first 100 terms from Reinhard Zumkeller)
R. E. Crandall, On the 3x+1 problem, Math. Comp., 32 (1978) 1281-1292.
J. Shallit and D. Wilson, The "3x+1" Problem and Finite Automata, Bulletin of the EATCS #46 (1992) pp. 182-185.
Eric Weisstein's World of Mathematics, Collatz Problem
FORMULA
A078719(a(n)) = 2; A006667(a(n)) = 1.
EXAMPLE
The Collatz trajectory of 5 is (5,16,8,4,2,1), which contains 2 odd integers.
MATHEMATICA
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countOdd[lst_] := Length[Select[lst, OddQ]]; Select[Range[22000], countOdd[Collatz[#]] == 2 &] (* T. D. Noe, Dec 03 2012 *)
PROG
(PARI) for(n=2, 100000, s=n; t=0; while(s!=1, if(s%2==0, s=s/2, s=3*s+1; t++); if(s*t==1, print1(n, ", "); ); ))
(Haskell)
import Data.List (elemIndices)
a062052 n = a062052_list !! (n-1)
a062052_list = map (+ 1) $ elemIndices 2 a078719_list
-- Reinhard Zumkeller, Oct 08 2011
(Python)
def a(n):
l=[n, ]
while True:
if n%2==0: n//=2
else: n = 3*n + 1
if n not in l:
l.append(n)
if n<2: break
else: break
return len([i for i in l if i % 2])
print([n for n in range(1, 22001) if a(n)==2]) # Indranil Ghosh, Apr 14 2017
CROSSREFS
Is this a subset of A115774?
Column k=2 of A354236.
Sequence in context: A300019 A115825 A115774 * A245387 A115799 A072703
KEYWORD
nonn
STATUS
approved