login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #18 Dec 04 2024 10:16:28

%S 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,

%T 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,

%U 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

%N m^p-n, for smallest m^p>=n.

%C a(n) = 0 if n = m^p that is if n is a full power (square, cube etc.).

%C 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

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Catalan%27s_conjecture">Catalan's conjecture</a>

%F a(n) = A377468(n) - n. - _Gus Wiseman_, Dec 02 2024

%t 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 *)

%o (PARI) a(n) = { if (n==1, return (0)); my(nn = n); while(! ispower(nn), nn++); return (nn - n);} \\ _Michel Marcus_, Apr 19 2013

%Y Sequences obtained by subtracting n from each term are placed in parentheses below.

%Y Positions of 0 are A001597.

%Y Positions of 1 are A375704.

%Y The version for primes is A007920 (A007918).

%Y The opposite (greatest perfect power <= n) is A069584 (A081676).

%Y The version for perfect powers is A074984 (this) (A377468).

%Y The version for squarefree numbers is A081221 (A067535).

%Y The version for non perfect powers is A378357 (A378358).

%Y The version for nonsquarefree numbers is A378369 (A120327).

%Y The version for prime powers is A378370 (A000015).

%Y The version for non prime powers is A378371 (A378372).

%Y A001597 lists the perfect powers, differences A053289.

%Y A007916 lists the non perfect powers, differences A375706.

%Y A069623 counts perfect powers <= n.

%Y A076411 counts perfect powers < n.

%Y A131605 lists perfect powers that are not prime powers.

%Y A377432 counts perfect powers between primes, zeros A377436.

%Y Cf. A014210, A023055, A045542, A052410, A076412, A151800, A188951, A216765.

%K nonn,changed

%O 1,2

%A _Zak Seidov_, Oct 07 2002