OFFSET
0,3
COMMENTS
LINKS
FORMULA
EXAMPLE
The first terms, alongside their binary expansion, are:
n a(n) bin(n) bin(a(n))
-- ---- ------ ---------
0 0 0 0
1 1 1 1
2 2 10 10
3 3 11 11
4 4 100 100
5 4 101 100
6 6 110 110
7 7 111 111
8 8 1000 1000
9 8 1001 1000
10 8 1010 1000
11 8 1011 1000
12 12 1100 1100
13 12 1101 1100
14 14 1110 1110
15 15 1111 1111
PROG
(PARI) a(n) = { my (b=binary(n), p=1); for (k=1, #b, b[k] = p*=b[k]); fromdigits(b, 2) }
(Python)
def A342126(n):
s = bin(n)[2:]
i = s.find('0')
return n if i == -1 else (2**i-1)*2**(len(s)-i) # Chai Wah Wu, Apr 29 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Apr 25 2021
STATUS
approved