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.

A055048 Numbers of the form 9^i*(3*j+2).

Original entry on oeis.org

2, 5, 8, 11, 14, 17, 18, 20, 23, 26, 29, 32, 35, 38, 41, 44, 45, 47, 50, 53, 56, 59, 62, 65, 68, 71, 72, 74, 77, 80, 83, 86, 89, 92, 95, 98, 99, 101, 104, 107, 110, 113, 116, 119, 122, 125, 126, 128, 131, 134, 137, 140, 143, 146, 149, 152, 153, 155
Offset: 1

Views

Author

N. J. A. Sloane, Jun 01 2000

Keywords

Comments

The numbers not of the form x^2+3y^2+3z^2.
Numbers whose squarefree part is congruent to 2 modulo 3. - Peter Munn, May 17 2020
The asymptotic density of this sequence is 3/8. - Amiram Eldar, Mar 08 2021

Crossrefs

Intersection of A007417 and A189716.
Complement of A055047 with respect to A007417.
Complement of A055041 with respect to A189716.

Programs

  • Haskell
    a055048 n = a055048_list !! (n-1)
    a055048_list = filter (s 0) [1..] where
       s t u | m > 0  = even t && m == 2
             | m == 0 = s (t + 1) u' where (u',m) = divMod u 3
    -- Reinhard Zumkeller, Apr 07 2012
    
  • Mathematica
    max = 200; Select[ Union[ Flatten[ Table[ 9^i*(3*j + 2), {i, 0, Ceiling[Log[max]/Log[9]]}, {j, 0, Ceiling[( max/9^i - 2)/3]}]]], # <= max &] (* Jean-François Alcover, Oct 13 2011 *)
  • PARI
    is(n)=n/=9^valuation(n, 9); n%3==2 \\ Charles R Greathouse IV and V. Raman, Dec 19 2013
    
  • Python
    from sympy import integer_log
    def A055048(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//9**i-2)//3+1 for i in range(integer_log(x,9)[0]+1))
        return bisection(f,n,n) # Chai Wah Wu, Feb 14 2025

Formula

a(n) = A055040(n)/3. - Peter Munn, May 17 2020