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.

A077680 Squarefree numbers beginning with 4.

Original entry on oeis.org

41, 42, 43, 46, 47, 401, 402, 403, 406, 407, 409, 410, 411, 413, 415, 417, 418, 419, 421, 422, 426, 427, 429, 430, 431, 433, 434, 435, 437, 438, 439, 442, 443, 445, 446, 447, 449, 451, 453, 454, 455, 457, 458, 461, 462, 463, 465, 466, 467, 469, 470, 471, 473
Offset: 1

Views

Author

Amarnath Murthy, Nov 16 2002

Keywords

Comments

Lower density is 3/(20*Pi^2), upper density is 4/(3*Pi^2). - Charles R Greathouse IV, Nov 05 2017

Crossrefs

Programs

  • Maple
    select(numtheory:-issqrfree, [seq(seq(i,i=4*10^d+1 .. 5*10^d-1),d=1..3)]); # Robert Israel, May 07 2025
  • Mathematica
    Select[Range[499],First[IntegerDigits[#]]==4&&SquareFreeQ[#]&] (* Harvey P. Dale, Apr 24 2018 *)
  • PARI
    is(n)=n>40 && digits(n)[1]==4 && issquarefree(n) \\ Charles R Greathouse IV, Nov 05 2017
    
  • Python
    from functools import lru_cache
    from math import isqrt
    from sympy import mobius
    def A077680(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
        @lru_cache(maxsize=None)
        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<4 else h(5*10**((l:=len(s:=str(x)))-2)-1)-g(4*10**(l-1)-1)+(g(x) if s[0]=='4' else g(5*10**(l-1)-1) if s[0]>'4' else 0)
        def f(x): return n+x-h(x)
        return bisection(f,n,n) # Chai Wah Wu, May 07 2025

Extensions

More terms from Sascha Kurz, Jan 28 2003