login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A301573 Distance to nearest perfect power n^k, k>=2 (A001597). 3
1, 0, 1, 1, 0, 1, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 3, 4, 4, 3, 2, 1, 0, 1, 0, 1, 2, 2, 1, 0, 1, 2, 1, 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,7
COMMENTS
Differs from A061670 at n=36.
Let b(n) be the smallest t such that a(t) = n. Initial values of b(n) are 1, 0, 6, 12, 20, 41, 42, 56, 72, 90, 110, 155, 156, 182, 270, 271, 272, 306, 379, ...
The b(n) sequence determines the positions of certain humps of a(n) sequence. See scatterplot of this sequence in order to observe general structure of a(n).
b(n) is A366928(n). - Dmitry Kamenetsky, Oct 28 2023
LINKS
FORMULA
a(n) = 0 iff n belongs to A001597.
EXAMPLE
a(20) = a(21) = 4 because 16 is the nearest perfect power to 20 and 25 is the nearest perfect power to 21 (20 - 16 = 25 - 21 = 4).
a(36) = 0 because 36 is a square.
PROG
(PARI) isA001597(n) = {ispower(n) || n==1}
a(n) = {my(k=0); while(!isA001597(n+k) && !isA001597(n-k), k++); k; }
(Python)
from itertools import count
from sympy import perfect_power
def A301573(n): return next(k for k in count(0) if perfect_power(n+k) or perfect_power(n-k) or n-k==1 or n+k==1) # Chai Wah Wu, Nov 12 2023
CROSSREFS
Sequence in context: A058755 A128519 A303979 * A061670 A236412 A236263
KEYWORD
nonn
AUTHOR
Rémy Sigrist and Altug Alkan, Mar 23 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 00:26 EDT 2024. Contains 371264 sequences. (Running on oeis4.)