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!)
A322522 a(n) is the minimal absolute difference between n and each of the powers of the previous terms; a(1) = 1. 1
1, 1, 2, 0, 1, 2, 1, 0, 1, 2, 3, 3, 3, 2, 1, 0, 1, 2, 3, 4, 5, 3, 2, 1, 0, 1, 0, 1, 2, 2, 1, 0, 1, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
a(n) <= ceiling(sqrt(n)); if n is between k^2 and (k+1)^2, we have min(n - k^2, (k+1)^2 - n) <= k < ceiling(sqrt(n)).
Using the fact that the density of the nontrivial powers over the integers is 0, and that the density of cubes and higher powers among the nontrivial powers is 0, we can show that there are an infinite number of integers i such that i is not a nontrivial power, and there is no cube or higher power between (i-1)^2 and i^2. We then have a((i-1)^2 + i) = i = ceiling(sqrt((i-1)^2 + i)). Therefore there are infinitely many numbers n such that a(n) = ceiling(sqrt(n)).
a(n) - a(n-1) <= 1.
For the first 10000 terms, indices for a(n) = 1 correspond to 85 of 90 values of A227802(m). - Bill McEachen, Feb 26 2024
LINKS
FORMULA
Let b(n) be the first time that n appears in the sequence; then b(n) ~ n^2.
EXAMPLE
For n = 4, we have a(4) = 0, because a(3) = 2, and 2^2 - 4 = 0.
For n = 6, we have a(6) = 0, because there are only 0, 1 and 2 in the first 5 terms, and therefore the closest power is 2^2 = 4 or 2^3 = 8, with an absolute difference of 2.
MATHEMATICA
comparePowers[n_, m_] :=
If[n <= 1, m - n, a = n; While[a < m, a *= n];
Min[m - a/n, a - m]]; list = {1}; cleanList = {1}; Do[
list = Append[list,
Min[comparePowers[#, Length[list] + 1] & /@ cleanList]];
If[Last[list] > Last[cleanList],
cleanList = Append[cleanList, Last[list]]], 9999]; Print[list]
CROSSREFS
Cf. A301573 (distance from n to the nearest nontrivial power).
Sequence in context: A293388 A268833 A293386 * A168121 A158948 A140224
KEYWORD
nonn,easy,look,nice,hear
AUTHOR
Gabin Kolly, Aug 28 2019
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 April 23 10:29 EDT 2024. Contains 371905 sequences. (Running on oeis4.)