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 A366928 #37 Nov 13 2023 07:17:34 %S A366928 1,0,6,12,20,41,42,56,72,90,110,155,156,182,270,271,272,306,379,380, %T A366928 420,462,551,552,600,650,702,756,812,870,930,1055,1056,1122,1190,1260, %U A366928 1405,1406,1482,1560,1640,1805,1806,1892,1980,2254,2255,2256,2352,2450,2550,2652,2861,2862,2970 %N A366928 a(n) is the smallest nonnegative k such that A301573(k) = n. %C A366928 If negative values were allowed then one could argue a(n) = 1-n from the name of A301573. - _David A. Corneth_, Nov 13 2023 %H A366928 David A. Corneth, <a href="/A366928/b366928.txt">Table of n, a(n) for n = 0..10000</a> %H A366928 David A. Corneth, <a href="/A366928/a366928_1.gp.txt">PARI program</a> %F A366928 a(n) > n^2 for n > 1. - _David A. Corneth_, Nov 13 2023 %e A366928 a(3) = 12 as 12 is the smallest positive integer that is 3 away from the closest perfect power (namely 9 = 3^2). - _David A. Corneth_, Nov 12 2023 %o A366928 (PARI) ispp(n) = {ispower(n) || n==1}; \\ A001597 %o A366928 f(n) = my(k=0); while(!ispp(n+k) && !ispp(n-k), k++); k; \\ A301573 %o A366928 a(n) = my(k=0); while (f(k) != n, k++); k; \\ _Michel Marcus_, Oct 29 2023 %o A366928 (PARI) \\ See PARI link %o A366928 (Python) %o A366928 from itertools import count %o A366928 from sympy import perfect_power %o A366928 def A366928(n): return next(m for m in count(0) if next(k for k in count(0) if perfect_power(m+k) or perfect_power(m-k) or m-k==1 or m+k==1) == n) # _Chai Wah Wu_, Nov 12 2023 %Y A366928 Cf. A001597, A301573. %K A366928 nonn %O A366928 0,3 %A A366928 _Dmitry Kamenetsky_, Oct 28 2023 %E A366928 More terms from _Michel Marcus_, Oct 29 2023