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

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

A378357 Distance from n to the least non perfect power >= n.

Original entry on oeis.org

1, 0, 0, 1, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Gus Wiseman, Nov 24 2024

Keywords

Comments

Perfect powers (A001597) are 1 and numbers with a proper integer root, complement A007916.
All terms are <= 2 because the only adjacent perfect powers are 8 and 9.

Crossrefs

The version for prime numbers is A007920, subtraction of A159477 or A007918.
The version for perfect powers is A074984, subtraction of A377468.
The version for squarefree numbers is A081221, subtraction of A067535.
Subtracting from n gives A378358, opposite A378363.
The opposite version is A378364.
The version for nonsquarefree numbers is A378369, subtraction of A120327.
The version for prime powers is A378370, subtraction of A000015.
The version for non prime powers is A378371, subtraction of A378372.
The version for composite numbers is A378456, subtraction of A113646.
A000961 lists the powers of primes, differences A057820.
A001597 lists the perfect powers, differences A053289, seconds A376559.
A007916 lists the non perfect powers, differences A375706, seconds A376562.
A069623 counts perfect powers <= n.
A076411 counts perfect powers < n.
A377432 counts perfect powers between primes, zeros A377436.

Programs

  • Mathematica
    perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1;
    Table[NestWhile[#+1&,n,#>1&&perpowQ[#]&]-n,{n,100}]
  • Python
    from sympy import perfect_power
    def A378357(n): return 0 if n>1 and perfect_power(n)==False else 1 if perfect_power(n+1)==False else 2 # Chai Wah Wu, Nov 27 2024

Formula

a(n) = n - A378358(n).

A378358 Least non-perfect-power >= n.

Original entry on oeis.org

2, 2, 3, 5, 5, 6, 7, 10, 10, 10, 11, 12, 13, 14, 15, 17, 17, 18, 19, 20, 21, 22, 23, 24, 26, 26, 28, 28, 29, 30, 31, 33, 33, 34, 35, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 65, 66, 67
Offset: 1

Views

Author

Gus Wiseman, Nov 24 2024

Keywords

Comments

Perfect-powers (A001597) are 1 and numbers with a proper integer root, complement A007916.

Crossrefs

The version for prime-powers is A000015, for non-prime-powers A378372.
The union is A007916, complement A001597.
The version for nonsquarefree numbers is A067535, negative A120327 (subtract A378369).
The version for composite numbers is A113646.
The version for prime numbers is A159477.
The run-lengths are A375706.
Terms appearing only once are A375738, multiple times A375703.
The version for perfect-powers is A377468.
Subtracting from n gives A378357.
The opposite version is A378363, for perfect-powers A081676.
A000040 lists the primes, differences A001223.
A000961 lists the powers of primes, differences A057820.
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
    perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1;
    Table[NestWhile[#+1&,n,perpowQ[#]&],{n,100}]
  • Python
    from sympy import mobius, integer_nthroot
    def A378358(n):
        def f(x): return int(1-sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(2,x.bit_length())))
        a = max(1,n-f(n-1))
        m, k = a, f(a)+a
        while m != k: m, k = k, f(k)+a
        return m # Chai Wah Wu, Nov 26 2024
    
  • Python
    from sympy import perfect_power
    def A378358(n): return n if n>1 and perfect_power(n)==False else n+1 if perfect_power(n+1)==False else n+2 # Chai Wah Wu, Nov 27 2024

Formula

a(n) = n - A378357(n).

A378373 Number of composite numbers (A002808) between consecutive nonsquarefree numbers (A013929), exclusive.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Dec 02 2024

Keywords

Comments

All terms are 0, 1, 2, or 3 (cf. A078147).
The inclusive version is a(n) + 2.
The nonsquarefree numbers begin: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, 28, 32, 36, 40, ...

Examples

			The composite numbers counted by a(n) form the following set partition of A120944:
{6}, {}, {10}, {14,15}, {}, {}, {21,22}, {}, {26}, {}, {30}, {33,34,35}, {38,39}, ...
		

Crossrefs

For prime (instead of nonsquarefree) we have A046933.
For squarefree (instead of nonsquarefree) we have A076259(n)-1.
For prime power (instead of nonsquarefree) we have A093555.
For prime instead of composite we have A236575.
For nonprime prime power (instead of nonsquarefree) we have A378456.
For perfect power (instead of nonsquarefree) we have A378614, primes A080769.
A002808 lists the composite numbers.
A005117 lists the squarefree numbers, differences A076259.
A013929 lists the nonsquarefree numbers, differences A078147.
A073247 lists squarefree numbers with nonsquarefree neighbors.
A120944 lists squarefree composite numbers.
A377432 counts perfect-powers between primes, zeros A377436.
A378369 gives distance to the next nonsquarefree number (A120327).

Programs

  • Mathematica
    v=Select[Range[100],!SquareFreeQ[#]&];
    Table[Length[Select[Range[v[[i]]+1,v[[i+1]]-1],CompositeQ]],{i,Length[v]-1}]

A378458 Squarefree numbers k such that k + 1 is squarefree but k + 2 is not.

Original entry on oeis.org

2, 6, 10, 14, 22, 30, 34, 38, 42, 46, 58, 61, 66, 70, 73, 78, 82, 86, 94, 102, 106, 110, 114, 118, 122, 130, 133, 138, 142, 145, 154, 158, 166, 173, 178, 182, 186, 190, 194, 202, 205, 210, 214, 218, 222, 226, 230, 238, 246, 254, 258, 262, 266, 273, 277, 282
Offset: 1

Views

Author

Gus Wiseman, Dec 02 2024

Keywords

Comments

These are the positions of 2 in A378369 (difference between n and the next nonsquarefree number).
The asymptotic density of this sequence is Product_{p prime} (1 - 2/p^2) - Product_{p prime} (1 - 3/p^2) = A065474 - A206256 = 0.19714711803343537224... . - Amiram Eldar, Dec 03 2024

Crossrefs

Complement of A007675 within A007674.
The version for prime power instead of nonsquarefree is a subset of A006549.
Another variation is A073247.
The version for nonprime instead of squarefree is A179384.
Positions of 0 in A378369 are A013929.
Positions of 1 in A378369 are A373415.
Positions of 2 in A378369 are A378458 (this).
Positions of 3 in A378369 are A007675.
A000961 lists the powers of primes, differences A057820.
A120327 gives the least nonsquarefree number >= n.
A378373 counts composite numbers between nonsquarefree numbers.

Programs

  • Mathematica
    Select[Range[100],NestWhile[#+1&,#,SquareFreeQ[#]&]==#+2&]
  • PARI
    list(lim) = my(q1 = 1, q2 = 1, q3); for(k = 3, lim, q3 = issquarefree(k); if(q1 && q2 &&!q3, print1(k-2, ", ")); q1 = q2; q2 = q3); \\ Amiram Eldar, Dec 03 2024
Showing 1-5 of 5 results.