A264964 Numbers that are the sum of two binary palindromes of the same (binary) length.
0, 2, 6, 10, 12, 14, 18, 24, 30, 34, 38, 42, 44, 48, 52, 54, 58, 62, 66, 78, 84, 90, 96, 102, 108, 114, 126, 130, 138, 146, 150, 158, 164, 166, 170, 172, 178, 180, 184, 186, 192, 198, 200, 204, 206, 212, 214, 218, 220, 226, 234, 238, 246, 254, 258, 282, 294, 306, 318, 324, 330, 342, 348, 354, 360, 372, 378, 384, 390, 396
Offset: 1
Examples
There are four binary palindromes of length 5, namely (written in base 10) 17, 21, 27, 31, and adding them in pairs gives nine distinct numbers: 34, 38, 42, 44, 48, 52, 54, 58, 62. There are eight binary palindromes of length 7, namely (written in base 10) 65, 73, 85, 93, 99, 107, 119, 127, and adding them in pairs gives 27 distinct numbers: 130, 138, 146, 150, 158, 164, 166, 170, 172, 178, 180, 184, 186, 192, 198, 200, 204, 206, 212, 214, 218, 220, 226, 234, 238, 246, 254.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..13122
Programs
-
Mathematica
f[n_] := Select[Map[FromDigits /@ IntegerDigits[#, 2] &, Map[Function[k, {k, # - k}], Range@ Floor[#/2]] &@ n], AllTrue[#, Reverse@ # == # &@ IntegerDigits@ # &] && IntegerLength@ First@ # == IntegerLength@ Last@ # &]; Prepend[Select[Range@ 400, Length@ f@ # > 0 &], 0] (* Michael De Vlieger, Nov 29 2015, Mma version 10 *) Join[{0},Table[Total/@Tuples[FromDigits[#,2]&/@Select[Tuples[{1,0},n], #[[1]] != 0&==Reverse[#]&],2]//Union,{n,8}]//Flatten] (* Harvey P. Dale, Apr 12 2017 *)
Comments