OFFSET
0,3
COMMENTS
The idea is to keep the 1's in the binary expansion of a number whose positions are related in some way to that number.
LINKS
FORMULA
a(n) <= n.
EXAMPLE
For n = 42:
- 42 = 2^5 + 2^3 + 2^1,
- 5+1 divides 42,
- 3+1 does not divide 42,
- 1+1 divides 42,
- so a(42) = 2^5 + 2^1 = 34.
PROG
(PARI) a(n) = { my (v=0, m=n, k); while (m, m-=2^k=valuation(m, 2); if (n%(k+1)==0, v+=2^k)); v }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Mar 16 2022
STATUS
approved