OFFSET
1,1
COMMENTS
A Collatz-like function: the difference is that for odd n the term 3n+1 is calculated without overflow, only using xor operations (n xor(2n+1)). It is known that for each argument the iterated function always ends up in a cycle which contains 1 (namely 1-2-1).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..8192
PROG
(Haskell)
import Data.List (transpose)
a245471 n = a245471_list !! (n-1)
a245471_list = concat $ transpose [odds a065621_list, [1..]]
where odds [] = []; odds [x] = []; odds (_:x:xs) = x : odds xs
-- Reinhard Zumkeller, Jul 27 2014
(Python)
def A245471(n): return (m:=n+1)^ (m&~-m)<<1 if n&1 else n>>1 # Chai Wah Wu, Jun 29 2022
CROSSREFS
KEYWORD
AUTHOR
Reinhard Muehlfeld, Jul 23 2014
EXTENSIONS
Definition corrected by Chai Wah Wu, Jun 29 2022
STATUS
approved