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.

A077677 Squarefree numbers beginning with 1.

Original entry on oeis.org

1, 10, 11, 13, 14, 15, 17, 19, 101, 102, 103, 105, 106, 107, 109, 110, 111, 113, 114, 115, 118, 119, 122, 123, 127, 129, 130, 131, 133, 134, 137, 138, 139, 141, 142, 143, 145, 146, 149, 151, 154, 155, 157, 158, 159, 161, 163, 165, 166, 167, 170, 173, 174, 177
Offset: 1

Views

Author

Amarnath Murthy, Nov 16 2002

Keywords

Comments

Intersection of A005117 and A131835. - Michel Marcus, Sep 14 2013
Lower density is 3/(5*Pi^2), upper density is 10/(3*Pi^2). - Charles R Greathouse IV, Nov 05 2017

Crossrefs

Programs

  • Mathematica
    Select[Range[177], First[IntegerDigits[#]]==1 && SquareFreeQ[#] &] (* Jayanta Basu, May 23 2013 *)
  • PARI
    is(n)=n>0 && digits(n)[1]==1 && issquarefree(n) \\ Charles R Greathouse IV, Nov 05 2017
    
  • PARI
    list(lim)=my(v=List([1])); for(d=1,#Str(lim\=1)-1, my(D=10^d); forsquarefree(n=D,min(2*D,lim), listput(v,n[1]))); Vec(v) \\ Charles R Greathouse IV, Jan 10 2023
    
  • Python
    from math import isqrt
    from sympy import mobius
    def A077677(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 g(x): return int(sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1)))
        def h(x): return 0 if x<1 else h(2*10**((l:=len(s:=str(x)))-2)-1)-g((m:=10**(l-1))-1)+(g(x) if s[0]=='1' else g((m<<1)-1))
        def f(x): return n+x-h(x)
        return bisection(f,n,n) # Chai Wah Wu, May 06 2025

Extensions

Corrected and extended by Sascha Kurz, Jan 28 2003