login
A243256
Smallest distance of the n-th Fibonacci number to the set of all square integers.
1
0, 0, 0, 1, 1, 1, 1, 3, 4, 2, 6, 8, 0, 8, 16, 15, 26, 3, 17, 44, 41, 79, 22, 96, 143, 51, 289, 169, 285, 140, 296, 669, 267, 1449, 343, 1979, 144, 592, 665, 4223, 699, 5283, 2872, 19604, 6477, 21826, 17999, 16008, 46080, 31240, 102696, 8638, 45526, 95764
OFFSET
0,8
COMMENTS
a(n) = 0 if and only if n = 0, 1, 2, 12.
The sorted unique members: 0, 1, 2, 3, 4, 6, 8, 15, 16, 17, 22, 26 ...
LINKS
FORMULA
a(n) = min(A190993(n), A216223(n)).
MATHEMATICA
a[n_Integer]:=Module[{f, i}, If[n<0, 0, f=Fibonacci[n]; i=Floor[Sqrt[f]]; Min[f-i^2, (i+1)^2-f]]]
Table[a[n], {n, 0, 70}] (* Vincenzo Librandi, Jan 20 2026 *)
PROG
(SageMath)
def a(n):
f = fibonacci(n)
return min((floor(sqrt(f))+1)^2 - f, f - floor(sqrt(f))^2)
(PARI) {a(n) = my(f, i); if( n<0, 0, i = sqrtint( f = fibonacci(n))); min(f - i^2, (i+1)^2 - f)}; /* Michael Somos, Jun 02 2014 */
(Magma) a := function(n) local f, i; if n lt 0 then return 0; end if; f := Fibonacci(n); i := Floor(Sqrt(f)); return Minimum(f - i^2, (i + 1)^2 - f); end function; [ a(n) : n in [0..70] ]; // Vincenzo Librandi, Jan 20 2026
CROSSREFS
Sequence in context: A372862 A143052 A297104 * A269868 A344968 A324340
KEYWORD
nonn
AUTHOR
Ralf Stephan, Jun 02 2014
STATUS
approved