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.

A055045 Numbers of the form 4^i*(8*j+5).

Original entry on oeis.org

5, 13, 20, 21, 29, 37, 45, 52, 53, 61, 69, 77, 80, 84, 85, 93, 101, 109, 116, 117, 125, 133, 141, 148, 149, 157, 165, 173, 180, 181, 189, 197, 205, 208, 212, 213, 221, 229, 237, 244, 245, 253, 261, 269, 276, 277, 285, 293, 301, 308, 309, 317, 320, 325, 333, 336, 340, 341
Offset: 1

Views

Author

N. J. A. Sloane, Jun 01 2000

Keywords

Comments

Numbers not of the form x^2+2y^2+6z^2.

Crossrefs

Programs

  • Haskell
    a055045 n = a055045_list !! (n-1)
    a055045_list = filter ((== 5) . (flip mod 8) . f) [1..] where
       f x = if r == 0 then f x' else x  where (x', r) = divMod x 4
    -- Reinhard Zumkeller, Jan 02 2014
    
  • Mathematica
    A055045Q[k_] := Mod[k/4^IntegerExponent[k, 4], 8] == 5;
    Select[Range[500], A055045Q] (* Paolo Xausa, Mar 20 2025 *)
  • PARI
    is(n)=n/=4^valuation(n,4); n%8==5 \\ Charles R Greathouse IV and V. Raman, Dec 19 2013
    
  • Python
    from itertools import count, islice
    def A055045_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:not (m:=(~n&n-1).bit_length())&1 and (n>>m)&7==5, count(max(startvalue, 1)))
    A055045_list = list(islice(A055045_gen(), 30)) # Chai Wah Wu, Jul 09 2022
    
  • Python
    def A055045(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-sum(((x>>(i<<1))-5>>3)+1 for i in range(x.bit_length()>>1))
        return bisection(f,n,n) # Chai Wah Wu, Feb 14 2025

Formula

a(n) = 6n + O(log n). - Charles R Greathouse IV, Dec 19 2013
a(n) = A055042(n)/2. - Chai Wah Wu, Mar 19 2025