A055259 Sums of two powers of 8.
2, 9, 16, 65, 72, 128, 513, 520, 576, 1024, 4097, 4104, 4160, 4608, 8192, 32769, 32776, 32832, 33280, 36864, 65536, 262145, 262152, 262208, 262656, 266240, 294912, 524288, 2097153, 2097160, 2097216, 2097664, 2101248, 2129920, 2359296, 4194304, 16777217
Offset: 0
Links
- T. D. Noe, Rows n = 0..100 of triangle, flattened
Crossrefs
Cf. A052216.
Programs
-
Mathematica
Union[Total/@Tuples[8^Range[0,10], {2}]] (* Harvey P. Dale, Mar 13 2011 *)
-
Python
def valuation(n, b): v = 0 while n > 1: n //= b; v += 1 return v def aupto(lim): pows8 = [8**i for i in range(valuation(lim-1, 8) + 1)] sum_pows8 = sorted([a+b for i, a in enumerate(pows8) for b in pows8[i:]]) return [s for s in sum_pows8 if s <= lim] print(aupto(16777217)) # Michael S. Branicky, Feb 09 2021
-
Python
from math import isqrt def A055259(n): return (1<<3*(a:=(k:=isqrt(m:=n<<1))+(m>k*(k+1))-1))+(1<<3*(n-1-(a*(a+1)>>1))) # Chai Wah Wu, Apr 08 2025