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.
%I A378357 #14 Nov 27 2024 18:57:59 %S A378357 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, %T A378357 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, %U A378357 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0 %N A378357 Distance from n to the least non perfect power >= n. %C A378357 Perfect powers (A001597) are 1 and numbers with a proper integer root, complement A007916. %C A378357 All terms are <= 2 because the only adjacent perfect powers are 8 and 9. %F A378357 a(n) = n - A378358(n). %t A378357 perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1; %t A378357 Table[NestWhile[#+1&,n,#>1&&perpowQ[#]&]-n,{n,100}] %o A378357 (Python) %o A378357 from sympy import perfect_power %o A378357 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 %Y A378357 The version for prime numbers is A007920, subtraction of A159477 or A007918. %Y A378357 The version for perfect powers is A074984, subtraction of A377468. %Y A378357 The version for squarefree numbers is A081221, subtraction of A067535. %Y A378357 Subtracting from n gives A378358, opposite A378363. %Y A378357 The opposite version is A378364. %Y A378357 The version for nonsquarefree numbers is A378369, subtraction of A120327. %Y A378357 The version for prime powers is A378370, subtraction of A000015. %Y A378357 The version for non prime powers is A378371, subtraction of A378372. %Y A378357 The version for composite numbers is A378456, subtraction of A113646. %Y A378357 A000961 lists the powers of primes, differences A057820. %Y A378357 A001597 lists the perfect powers, differences A053289, seconds A376559. %Y A378357 A007916 lists the non perfect powers, differences A375706, seconds A376562. %Y A378357 A069623 counts perfect powers <= n. %Y A378357 A076411 counts perfect powers < n. %Y A378357 A377432 counts perfect powers between primes, zeros A377436. %Y A378357 Cf. A013597, A013603, A013632, A031218, A045542, A052410, A081676, A131605, A188951, A216765, A375702, A375736. %K A378357 nonn %O A378357 1,8 %A A378357 _Gus Wiseman_, Nov 24 2024