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.

A070321 Greatest squarefree number <= n.

Original entry on oeis.org

1, 2, 3, 3, 5, 6, 7, 7, 7, 10, 11, 11, 13, 14, 15, 15, 17, 17, 19, 19, 21, 22, 23, 23, 23, 26, 26, 26, 29, 30, 31, 31, 33, 34, 35, 35, 37, 38, 39, 39, 41, 42, 43, 43, 43, 46, 47, 47, 47, 47, 51, 51, 53, 53, 55, 55, 57, 58, 59, 59, 61, 62, 62, 62, 65, 66, 67, 67, 69, 70, 71, 71
Offset: 1

Views

Author

Benoit Cloitre, May 11 2002

Keywords

Comments

a(n) = Max( core(k) : k=1,2,3,...,n ) where core(x) is the squarefree part of x (the smallest integer such that x*core(x) is a square).

Examples

			From _Gus Wiseman_, Dec 10 2024: (Start)
The squarefree numbers <= n are the following columns, with maxima a(n):
  1  2  3  3  5  6  7  7  7  10  11  11  13  14  15  15
     1  2  2  3  5  6  6  6  7   10  10  11  13  14  14
        1  1  2  3  5  5  5  6   7   7   10  11  13  13
              1  2  3  3  3  5   6   6   7   10  11  11
                 1  2  2  2  3   5   5   6   7   10  10
                    1  1  1  2   3   3   5   6   7   7
                             1   2   2   3   5   6   6
                                 1   1   2   3   5   5
                                         1   2   3   3
                                             1   2   2
                                                 1   1
(End)
		

Crossrefs

The distinct terms are A005117 (the squarefree numbers).
The opposite version is A067535, differences A378087.
The run-lengths are A076259.
Restriction to the primes is A112925; see A378038, A112926, A378037.
For nonsquarefree we have A378033; see A120327, A378036, A378032, A377783.
First differences are A378085.
Subtracting each term from n gives A378619.
A013929 lists the nonsquarefree numbers, differences A078147.
A061398 counts squarefree numbers between primes, zeros A068360.
A061399 counts nonsquarefree numbers between primes, zeros A068361.

Programs

  • Maple
    A070321 := proc(n)
        local a;
        for a from n by -1 do
            if issqrfree(a) then
                return a;
            end if;
        end do:
    end proc:
    seq(A070321(n),n=1..100) ; # R. J. Mathar, May 25 2023
  • Mathematica
    a[n_] :=For[ k = n, True, k--, If[ SquareFreeQ[k], Return[k]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Mar 27 2013 *)
    gsfn[n_]:=Module[{k=n},While[!SquareFreeQ[k],k--];k]; Array[gsfn,80] (* Harvey P. Dale, Mar 27 2013 *)
  • PARI
    a(n) = while (! issquarefree(n), n--); n; \\ Michel Marcus, Mar 18 2017
    
  • Python
    from itertools import count
    from sympy import factorint
    def A070321(n): return next(m for m in count(n,-1) if max(factorint(m).values(),default=0)<=1) # Chai Wah Wu, Dec 04 2024

Formula

a(n) = n - o(n^(1/5)) by a result of Pandey. - Charles R Greathouse IV, Dec 04 2024
a(n) = A005117(A013928(n+1)). - Ridouane Oudra, Jul 26 2025

Extensions

New description from Reinhard Zumkeller, Oct 03 2002