A137595 Integers k such that the run lengths of identical digits in their binary expansion are palindromic after the rightmost bit is duplicated.
1, 3, 6, 7, 13, 15, 25, 26, 28, 31, 49, 53, 59, 63, 97, 102, 106, 109, 115, 116, 120, 127, 193, 201, 213, 221, 227, 235, 247, 255, 385, 398, 406, 409, 421, 426, 434, 445, 451, 460, 468, 475, 487, 488, 496, 511, 769, 785, 809, 825, 837, 853, 877, 893, 899, 915
Offset: 1
Examples
26 in binary is 11010. Appending a duplicate of the rightmost digit, 0, to the right gives 110100. The run lengths of consecutive identical binary digits is 2,1,1,2, which is a palindrome, so 26 is in the sequence. The fraction corresponding to the encoded continued fraction [0;2,1,1,2] is 5/13.
Links
- Dominic McCarty, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A014601.
Programs
-
Python
from itertools import groupby def ok(n): if n == 0: return False d = [len(list(g[1])) for g in groupby(bin(n)[2:])] d[-1] += 1 return all(d[i]==d[-i-1] for i in range(len(d)//2)) print((str([n for n in range(100) if ok(n)]))) # Dominic McCarty, Mar 04 2025
Extensions
Edited by Franklin T. Adams-Watters, Mar 29 2014
Name edited by Dominic McCarty, Mar 04 2025
Comments