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.

Showing 1-6 of 6 results.

A031218 Largest prime power <= n.

Original entry on oeis.org

1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 11, 13, 13, 13, 16, 17, 17, 19, 19, 19, 19, 23, 23, 25, 25, 27, 27, 29, 29, 31, 32, 32, 32, 32, 32, 37, 37, 37, 37, 41, 41, 43, 43, 43, 43, 47, 47, 49, 49, 49, 49, 53, 53, 53, 53, 53, 53, 59, 59, 61, 61, 61, 64, 64, 64, 67, 67, 67, 67, 71, 71
Offset: 1

Views

Author

Keywords

Comments

The length of the m-th run of {a(n)} is the length of the (m+1)-st run of A000015 for m > 1. - Colin Linzer, Mar 08 2024

Crossrefs

Programs

  • Haskell
    a031218 n = last $ takeWhile (<= n) a000961_list
    -- Reinhard Zumkeller, Apr 25 2011
    
  • Maple
    A031218 := proc(n)
        local a,pi,p,m ;
        a := 1 ;
        for pi from 1 do
            p := ithprime(pi) ;
            if p > n then
                return a;
            end if;
            for m from 0 do
                if p^m > n then
                    break;
                elif p^m <= n then
                    a := max(a,p^m) ;
                end if;
            end do:
        end do:
        a ;
    end proc:
    seq(A031218(n),n=1..40) ; # R. J. Mathar, Jul 20 2025
  • PARI
    a(n)=if(n<1,0, while(matsize(factor(n))[1]>1,n--); n)
    
  • Python
    from sympy import factorint
    def A031218(n): return next(filter(lambda m:len(factorint(m))<=1, range(n,0,-1))) # Chai Wah Wu, Oct 25 2024

Formula

a(n) = n - A378457(n). - R. J. Mathar, Jul 20 2025
a(n) = A000961(A065515(n)). - Ridouane Oudra, Aug 22 2025

Extensions

More terms from Erich Friedman

A378371 Distance between n and the least non prime power >= n, allowing 1.

Original entry on oeis.org

0, 4, 3, 2, 1, 0, 3, 2, 1, 0, 1, 0, 1, 0, 0, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0
Offset: 1

Views

Author

Gus Wiseman, Nov 28 2024

Keywords

Comments

Non prime powers allowing 1 (A361102) are numbers that are not a prime power (A246655), namely 1, 6, 10, 12, 14, 15, 18, 20, 21, 22, 24, ...

Examples

			The least non prime power >= 4 is 6, so a(4) = 2.
		

Crossrefs

Sequences obtained by adding n to each term are placed in parentheses below.
For prime we have A007920 (A151800), strict A013632.
For composite we have A010051 (A113646 except initial terms).
For perfect power we have A074984 (A377468)
For squarefree we have A081221 (A067535).
For nonsquarefree we have (A120327).
For non perfect power we have A378357 (A378358).
The opposite version is A378366 (A378367).
For prime power we have A378370, strict A377282 (A000015).
This sequence is A378371 (A378372).
A000040 lists the primes, differences A001223.
A000961 and A246655 list the prime powers, differences A057820.
A024619 and A361102 list the non prime powers, differences A375708 and A375735.
Prime powers between primes: A053607, A080101, A304521, A366833, A377057.

Programs

  • Mathematica
    Table[NestWhile[#+1&,n,PrimePowerQ[#]&]-n,{n,100}]

Formula

a(n) = A378372(n) - n.

A378372 Least non prime power >= n, allowing 1.

Original entry on oeis.org

1, 6, 6, 6, 6, 6, 10, 10, 10, 10, 12, 12, 14, 14, 15, 18, 18, 18, 20, 20, 21, 22, 24, 24, 26, 26, 28, 28, 30, 30, 33, 33, 33, 34, 35, 36, 38, 38, 39, 40, 42, 42, 44, 44, 45, 46, 48, 48, 50, 50, 51, 52, 54, 54, 55, 56, 57, 58, 60, 60, 62, 62, 63, 65, 65, 66, 68
Offset: 1

Views

Author

Gus Wiseman, Nov 29 2024

Keywords

Comments

Non prime powers allowing 1 (A361102) are numbers that are not a prime power (A246655), namely 1, 6, 10, 12, 14, 15, 18, 20, 21, 22, 24, ...

Examples

			The least non prime power >= 4 is 6, so a(4) = 6.
		

Crossrefs

Sequences obtained by subtracting n from each term are placed in parentheses below.
For prime power we have A000015 (A378370).
For squarefree we have A067535 (A081221).
For composite we have A113646 (A010051).
For nonsquarefree we have A120327.
For prime we have A151800 (A007920), strict (A013632).
Run-lengths are 1 and A375708.
For perfect power we have A377468 (A074984).
For non-perfect power we have A378358 (A378357).
The opposite is A378367, distance A378366.
This sequence is A378372 (A378371).
A000040 lists the primes, differences A001223.
A000961 and A246655 list the prime powers, differences A057820.
A024619 and A361102 list the non prime powers, differences A375708 and A375735.
Prime powers between primes: A053607, A080101, A304521, A366833, A377057.

Programs

  • Mathematica
    Table[NestWhile[#+1&,n,PrimePowerQ[#]&],{n,100}]

Formula

a(n) = A378371(n) + n.

A378370 Distance between n and the least prime power >= n, allowing 1.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 0, 0, 1, 0, 3, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 4, 3, 2, 1, 0, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 1, 0, 2, 1, 0, 2, 1, 0, 3, 2, 1, 0, 1, 0, 5, 4, 3, 2, 1, 0, 1, 0, 1, 0, 5, 4, 3, 2
Offset: 1

Views

Author

Gus Wiseman, Nov 27 2024

Keywords

Comments

Prime powers allowing 1 are listed by A000961.

Crossrefs

Sequences obtained by adding n to each term are placed in parentheses below.
For prime instead of prime power we have A007920 (A007918), strict A013632.
For perfect power we have A074984 (A377468), opposite A069584 (A081676).
For squarefree we have A081221 (A067535).
The restriction to the prime numbers is A377281 (A345531).
The strict version is A377282 = a(n) + 1.
For non prime power instead of prime power we have A378371 (A378372).
The opposite version is A378457, strict A276781.
A000015 gives the least prime power >= n, opposite A031218.
A000040 lists the primes, differences A001223.
A000961 and A246655 list the prime powers, differences A057820.
A024619 and A361102 list the non prime powers, differences A375708 and A375735.
A151800 gives the least prime > n.
Prime-powers between primes: A053607, A080101, A304521, A366833, A377057.

Programs

  • Mathematica
    Table[NestWhile[#+1&,n,#>1&&!PrimePowerQ[#]&]-n,{n,100}]

Formula

a(n) = A000015(n) - n.
a(n) = A377282(n - 1) - 1 for n > 1.

A378367 Greatest non prime power <= n, allowing 1.

Original entry on oeis.org

1, 1, 1, 1, 1, 6, 6, 6, 6, 10, 10, 12, 12, 14, 15, 15, 15, 18, 18, 20, 21, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 30, 33, 34, 35, 36, 36, 38, 39, 40, 40, 42, 42, 44, 45, 46, 46, 48, 48, 50, 51, 52, 52, 54, 55, 56, 57, 58, 58, 60, 60, 62, 63, 63, 65, 66, 66
Offset: 1

Views

Author

Gus Wiseman, Nov 29 2024

Keywords

Comments

Non prime powers allowing 1 (A361102) are numbers that are not a prime power (A246655), namely 1, 6, 10, 12, 14, 15, 18, 20, 21, 22, 24, ...

Examples

			The greatest non prime power <= 7 is 6, so a(7) = 6.
		

Crossrefs

Sequences obtained by subtracting each term from n are placed in parentheses below.
For prime we have A007917 (A064722).
For nonprime we have A179278 (A010051 almost).
For perfect power we have A081676 (A069584).
For squarefree we have A070321.
For nonsquarefree we have A378033.
For non perfect power we have A378363.
The opposite is A378372, subtracting n A378371.
For prime power we have A031218 (A276781 - 1).
Subtracting from n gives (A378366).
A000015 gives the least prime power >= n (A378370).
A000040 lists the primes, differences A001223.
A000961 and A246655 list the prime powers, differences A057820.
A024619 and A361102 list the non prime powers, differences A375708 and A375735.
A151800 gives the least prime > n (A013632), weak version A007918 (A007920).
Prime powers between primes: A053607, A080101, A304521, A366833, A377057.
Cf. A356068.

Programs

  • Mathematica
    Table[NestWhile[#-1&,n,PrimePowerQ[#]&],{n,100}]

Formula

a(n) = n - A378366(n).
a(n) = A361102(A356068(n)). - Ridouane Oudra, Aug 22 2025

A378366 Difference between n and the greatest non prime power <= n (allowing 1).

Original entry on oeis.org

0, 1, 2, 3, 4, 0, 1, 2, 3, 0, 1, 0, 1, 0, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0
Offset: 1

Views

Author

Gus Wiseman, Nov 29 2024

Keywords

Comments

Non prime powers allowing 1 (A361102) are numbers that are not a prime power (A246655), namely 1, 6, 10, 12, 14, 15, 18, 20, 21, 22, 24, ...

Crossrefs

Sequences obtained by subtracting each term from n are placed in parentheses below.
For nonprime we almost have A010051 (A179278).
For prime we have A064722 (A007917).
For perfect power we have A069584 (A081676).
For squarefree we have (A070321).
For prime power we have A378457 = A276781-1 (A031218).
For nonsquarefree we have (A378033).
For non perfect power we almost have A075802 (A378363).
Subtracting from n gives (A378367).
The opposite is A378371, adding n A378372.
A000015 gives the least prime power >= n (cf. A378370 = A377282 - 1).
A000040 lists the primes, differences A001223.
A000961 and A246655 list the prime powers, differences A057820.
A024619 and A361102 list the non prime powers, differences A375708 and A375735.
A151800 gives the least prime > n, weak version A007918.
Prime powers between primes: A053607, A080101, A304521, A366833, A377057.

Programs

  • Mathematica
    Table[n-NestWhile[#-1&,n,PrimePowerQ[#]&],{n,100}]

Formula

a(n) = n - A378367(n).
Showing 1-6 of 6 results.