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-8 of 8 results.

A081676 Largest perfect power <= n.

Original entry on oeis.org

1, 1, 1, 4, 4, 4, 4, 8, 9, 9, 9, 9, 9, 9, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 25, 25, 27, 27, 27, 27, 27, 32, 32, 32, 32, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 26 2003

Keywords

Comments

a(n) = n if n is in A001597, otherwise a(n) = a(n-1). - Robert Israel, Dec 17 2015

Crossrefs

Programs

  • Maple
    N:= 1000: # to get a(1) to a(N).
    Powers:= {1,seq(seq(b^p, p=2..floor(log[b](N))),b=2..isqrt(N))}:
    Powers:= sort(convert(Powers,list)):
    j:= 1:
    for i from 1 to N do
      if i >= Powers[j+1] then j:= j+1 fi;
      A[i]:= Powers[j];
    od:
    seq(A[i],i=1..N); # Robert Israel, Dec 17 2015
  • Mathematica
    Array[SelectFirst[Range[#, 1, -1], Or[And[! PrimeQ@ #, GCD @@ FactorInteger[#][[All, -1]] > 1], # == 1] &] &, 72] (* Michael De Vlieger, Jun 14 2017 *)
  • PARI
    a(n) = {while(!ispower(n), n--; if (n==0, return (1))); n;} \\ Michel Marcus, Nov 04 2015
    
  • Python
    from sympy import mobius, integer_nthroot
    def A081676(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: 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 int(x-1+sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(2,x.bit_length())))
        m = n-f(n)
        return bisection(lambda x:f(x)+m,m-1,n+1) # Chai Wah Wu, Nov 05 2024
  • Sage
    p = [i for i in (1..81) if i.is_perfect_power()]
    r = [[p[i]]*(p[i+1]-p[i]) for i in (0..10)]
    print([y for x in r for y in x]) # Peter Luschny, Jun 13 2017
    

Formula

a(n) = n - A069584(n).
a(n) = A001597(A069623(n)). - Ridouane Oudra, Aug 26 2025

A074984 m^p-n, for smallest m^p>=n.

Original entry on oeis.org

0, 2, 1, 0, 3, 2, 1, 0, 0, 6, 5, 4, 3, 2, 1, 0, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 0, 4, 3, 2, 1, 0, 3, 2, 1, 0, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8
Offset: 1

Views

Author

Zak Seidov, Oct 07 2002

Keywords

Comments

a(n) = 0 if n = m^p that is if n is a full power (square, cube etc.).
This is the distance between n and the next perfect power. The previous perfect power is A081676, which differs from n by A069584. After a(8) = a(9) this sequence is an anti-run (no adjacent equal terms). - Gus Wiseman, Dec 02 2024

Crossrefs

Sequences obtained by subtracting n from each term are placed in parentheses below.
Positions of 0 are A001597.
Positions of 1 are A375704.
The version for primes is A007920 (A007918).
The opposite (greatest perfect power <= n) is A069584 (A081676).
The version for perfect powers is A074984 (this) (A377468).
The version for squarefree numbers is A081221 (A067535).
The version for non perfect powers is A378357 (A378358).
The version for nonsquarefree numbers is A378369 (A120327).
The version for prime powers is A378370 (A000015).
The version for non prime powers is A378371 (A378372).
A001597 lists the perfect powers, differences A053289.
A007916 lists the non perfect powers, differences A375706.
A069623 counts perfect powers <= n.
A076411 counts perfect powers < n.
A131605 lists perfect powers that are not prime powers.
A377432 counts perfect powers between primes, zeros A377436.

Programs

  • Mathematica
    powerQ[n_] := GCD @@ FactorInteger[n][[All, 2]] > 1; powerQ[1] = True; a[n_] := For[k = n, True, k++, If[powerQ[k], Return[k-n]]]; Table[a[n], {n, 1, 92}] (* Jean-François Alcover, Apr 19 2013 *)
  • PARI
    a(n) = { if (n==1, return (0)); my(nn = n); while(! ispower(nn), nn++); return (nn - n);} \\ Michel Marcus, Apr 19 2013

Formula

a(n) = A377468(n) - n. - Gus Wiseman, Dec 02 2024

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

A378457 Difference between n and the greatest prime power <= n, allowing 1.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 29 2024

Keywords

Comments

Prime powers allowing 1 are listed by A000961.

Examples

			The greatest prime power <= 6 is 5, so a(6) = 1.
		

Crossrefs

Sequences obtained by subtracting each term from n are placed in parentheses below.
For nonprime we have A010051 (almost) (A179278).
Subtracting from n gives (A031218).
For prime we have A064722 (A007917).
For perfect power we have A069584 (A081676).
For squarefree we have (A070321).
Adding one gives A276781.
For nonsquarefree we have (A378033).
For non perfect power we have (A378363).
For non prime power we have A378366 (A378367).
The opposite is A378370 = A377282-1.
A000015 gives the least prime power >= n.
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,#>1&&!PrimePowerQ[#]&],{n,100}]

Formula

a(n) = n - A031218(n).
a(n) = A276781(n) - 1.

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).

A378252 Least prime power > 2^n.

Original entry on oeis.org

2, 3, 5, 9, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169, 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459, 536870923, 1073741827, 2147483659, 4294967311, 8589934609
Offset: 0

Views

Author

Gus Wiseman, Nov 30 2024

Keywords

Comments

Prime powers are listed by A246655.
Conjecture: All terms except 9 are prime. Hence this is the same as A014210 after 9. Confirmed up to n = 1000.

Crossrefs

Subtracting 2^n appears to give A013597 except at term 3.
For prime we have A014210.
For previous we have A014234.
For perfect power we have A357751.
For squarefree we have A372683.
A000015 gives the least prime power >= n.
A000040 lists the primes, differences A001223.
A000961 and A246655 list the prime powers, differences A057820.
A024619 and A361102 list the non prime powers, diffs A375708 and A375735.
A031218 gives the greatest prime power <= n.
A244508 counts prime powers between powers of 2.
Prime powers between primes are counted by A080101 and A366833.

Programs

  • Mathematica
    Table[NestWhile[#+1&,2^n+1,!PrimePowerQ[#]&],{n,0,20}]
  • PARI
    a(n) = my(x=2^n+1); while (!isprimepower(x), x++); x; \\ Michel Marcus, Dec 03 2024
  • Python
    from itertools import count
    from sympy import primefactors
    def A378252(n): return next(i for i in count(1+(1<Chai Wah Wu, Dec 02 2024
    

A069585 a(n) = n - largest prime power <= n.

Original entry on oeis.org

0, 1, 2, 0, 1, 2, 3, 0, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0
Offset: 1

Views

Author

Amarnath Murthy, Mar 24 2002

Keywords

Comments

This sequence considers "prime powers" to be A025475 rather than A000961.
a(8)=a(9)=0. With Mihăilescu's proof of Catalan's conjecture (see A001597) there can be no further occurrence of consecutive zeros. - Robert Munafo, May 10 2024

Crossrefs

Programs

  • Mathematica
    nn = 10^4; s = {1}~Join~Select[Union@ Flatten@ Table[a^2*b^3, {b, Surd[nn, 3]}, {a, Sqrt[nn/b^3]}], PrimePowerQ]; Table[n - TakeWhile[s, # <= n &][[-1]], {n, nn}] (* Michael De Vlieger, May 11 2024 *)

Formula

a(n) = n - A167185(n). - Michel Marcus, May 10 2024

Extensions

Revised by Robert Munafo and Sean A. Irvine, May 10 2024
Showing 1-8 of 8 results.