Svoboda | Graniru | BBC Russia | Golosameriki | Facebook
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A348074 a(n) = A035327(n) if n is even, 3n + 1 if n is odd. 1
1, 4, 1, 10, 3, 16, 1, 22, 7, 28, 5, 34, 3, 40, 1, 46, 15, 52, 13, 58, 11, 64, 9, 70, 7, 76, 5, 82, 3, 88, 1, 94, 31, 100, 29, 106, 27, 112, 25, 118, 23, 124, 21, 130, 19, 136, 17, 142, 15, 148, 13, 154, 11, 160, 9, 166, 7, 172, 5, 178, 3, 184, 1, 190, 63 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
LINKS
EXAMPLE
n parity function a(n)
= ===== ========= ======
0 even A035327(0) 1
1 odd 3*1 + 1 4
2 even A035327(2) 1
3 odd 3*3 + 1 10
4 even A035327(4) 3
5 odd 3*5 + 1 16
PROG
(Python)
def A348074(n):
if n%2==0:
if n==0: return 1
else: return (1<<int.bit_length(n)) - n - 1 #A035327(n)
else: return 3*n+1
(Python)
def A348074(n): return 3*n+1 if n&1 or n==0 else (~n)^(-1<<n.bit_length()) # Chai Wah Wu, Dec 20 2022
CROSSREFS
Sequence in context: A262370 A108759 A158824 * A334161 A039806 A030320
KEYWORD
nonn
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 11 13:05 EDT 2024. Contains 375829 sequences. (Running on oeis4.)