cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A055259 Sums of two powers of 8.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Jun 22 2000

Keywords

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

Formula

a(n) = 8^(n-trinv(n))+8^trinv(n), where trinv(n) = floor((1+sqrt(1+8*n))/2) = A002262(n) and n-trinv(n) = A003056(n)
Regarded as a triangle T(n, k) = 8^n + 8^k, so as a sequence a(n) = 8^A002262(n) + 8^A003056(n).