OFFSET
1,2
COMMENTS
This is a simple sequence where the nesting of functions r(n), and s(n), are grouped in a special way: n = r(s(n)) = s(r(n)), and those three values must be equal.
LINKS
Andres M. Torres, Table of n, a(n) for n = 1..10000
FORMULA
Find all n, such that: n = r(s(n)) = s(r(n)), where r(n) = n+bitcount(n) and s(n) = n-bitcount(n)
EXAMPLE
0 = r(s(0)) = s(r(0)) = r(0) = s(0) = 0.
22 = r(s(22))= s(r(22)) = r(19) = s(25) = 22.
25 = r(s(25))= s(r(25)) = r(22) = s(28) = 25.
38 = r(s(38))= s(r(38)) = r(35) = s(41) = 38.
PROG
(PARI) npbc(n) = n + hammingweight(n)
nmbc(n) = n - hammingweight(n)
isok(n) = (n == npbc(nmbc(n))) && (n == nmbc(npbc(n))) \\ Michel Marcus, Aug 08 2013
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Andres M. Torres, Jul 10 2013
EXTENSIONS
Offset changed from 0 to 1 by Michel Marcus, Aug 08 2013
STATUS
approved