login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A153587
a(n) = n mod (A062383(n) - n).
1
0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 4, 1, 0, 1, 0, 0, 0, 2, 4, 6, 8, 10, 2, 5, 0, 4, 2, 2, 0, 2, 0, 0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 1, 4, 7, 10, 13, 0, 4, 8, 12, 4, 9, 4, 1, 0, 1, 4, 4, 0, 1, 0, 0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42
OFFSET
0,6
LINKS
FORMULA
a(n) = n mod A080079(n), for n > 0. - Michel Marcus, Jan 28 2018
PROG
(C) int A062383(int n) { if(n==0) return 1; return 2*(A062383(n/2)); }
int a(int n) { return n % (A062383(n)-n); }
(PARI) b(n) = if (n, 2*b(n\2), 1);
a(n) = n % (n - b(n)); \\ Michel Marcus, Jan 28 2018
(Python)
def A153587(n): return n % ((1 << n.bit_length())-n) # Chai Wah Wu, Jun 30 2022
CROSSREFS
Sequence in context: A308376 A228616 A151670 * A320437 A059286 A345940
KEYWORD
easy,nonn
AUTHOR
J. Z. Bradley (jzbradley(AT)gmail.com), Dec 29 2008
EXTENSIONS
More terms from Michel Marcus, Jan 28 2018
STATUS
approved