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.

A245471 If n is odd, then a(n) = A065621(n+1). If n is even, then a(n) = n/2.

This page as a plain text file.
%I A245471 #21 Jul 01 2022 09:39:44
%S A245471 2,1,4,2,14,3,8,4,26,5,28,6,22,7,16,8,50,9,52,10,62,11,56,12,42,13,44,
%T A245471 14,38,15,32,16,98,17,100,18,110,19,104,20,122,21,124,22,118,23,112,
%U A245471 24,82,25,84,26,94,27,88,28,74,29,76,30,70,31,64,32,194,33,196,34,206,35,200,36,218,37,220,38,214,39,208,40,242,41,244,42,254,43,248,44,234,45,236,46,230,47,224,48,162,49,164,50,174,51,168,52,186,53,188,54,182,55,176,56,146,57,148,58,158,59,152,60
%N A245471 If n is odd, then a(n) = A065621(n+1). If n is even, then a(n) = n/2.
%C A245471 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).
%H A245471 Reinhard Zumkeller, <a href="/A245471/b245471.txt">Table of n, a(n) for n = 1..8192</a>
%o A245471 (Haskell)
%o A245471 import Data.List (transpose)
%o A245471 a245471 n = a245471_list !! (n-1)
%o A245471 a245471_list = concat $ transpose [odds a065621_list, [1..]]
%o A245471    where odds [] = []; odds [x] = []; odds (_:x:xs) = x : odds xs
%o A245471 -- _Reinhard Zumkeller_, Jul 27 2014
%o A245471 (Python)
%o A245471 def A245471(n): return (m:=n+1)^ (m&~-m)<<1 if n&1 else n>>1 # _Chai Wah Wu_, Jun 29 2022
%Y A245471 Cf. A006370, A065621.
%K A245471 nonn,base,look
%O A245471 1,1
%A A245471 _Reinhard Muehlfeld_, Jul 23 2014
%E A245471 Definition corrected by _Chai Wah Wu_, Jun 29 2022