The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A352458 2^k appears in the binary expansion of a(n) iff 2^k appears in the binary expansion of n and k AND n = 0 (where AND denotes the bitwise AND operator). 5
 0, 1, 2, 1, 4, 5, 2, 1, 8, 1, 2, 1, 12, 5, 2, 1, 16, 17, 18, 17, 4, 5, 2, 1, 24, 17, 18, 17, 12, 5, 2, 1, 32, 1, 34, 1, 4, 5, 2, 1, 40, 1, 34, 1, 12, 5, 2, 1, 48, 17, 50, 17, 4, 5, 2, 1, 56, 17, 50, 17, 12, 5, 2, 1, 64, 65, 2, 1, 4, 5, 2, 1, 72, 65, 2, 1, 12 (list; graph; refs; listen; history; text; internal format)
 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 Rémy Sigrist, Table of n, a(n) for n = 0..8192 FORMULA a(n) <= n with equality iff n belongs to A335702. a(n) = n - A309274(n). EXAMPLE For n = 42: - 42 = 2^5 + 2^3 + 2^1, - 42 AND 5 = 0, - 42 AND 3 = 2 <> 0, - 42 AND 1 = 0, - 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 (bitand(n, k)==0, v+=2^k)); v } CROSSREFS See A352449, A352450, A352451, A352452 for similar sequences. Cf. A335702 (fixed points). Sequence in context: A114158 A248666 A162407 * A132741 A072436 A247503 Adjacent sequences: A352455 A352456 A352457 * A352459 A352460 A352461 KEYWORD nonn,base AUTHOR Rémy Sigrist, Mar 17 2022 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.

Last modified January 31 01:17 EST 2023. Contains 359947 sequences. (Running on oeis4.)