OFFSET
0,4
COMMENTS
a(n) <= n for n > 0. If prime p == 3 (mod 4) then a(p) = p.
Conjecture: a(p) < p for prime p == 1 (mod 4).
Outline of proof of conjecture: write p = x^2 + y^2. Since gcd(x,y) = 1, there are u,v with x*u + y*v = 1, u^2 + v^2 < y^2 + x^2 = p. Taking s = u^2 + v^2, s*p = (u*y+v*x)^2 + 1^2, and |u*y+v*x| = floor(sqrt(s*p)). - Robert Israel, Aug 04 2014
For the first 100000 primes p == 1 (mod 4), a(p) < sqrt(p)/2. - Robert Israel, Aug 03 2014
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
MAPLE
A:= proc(n) local s, a;
for s from 1 do
a:= floor(sqrt(s*n));
if issqr(s*n-a^2) then return s fi
od
end proc:
seq(A(n), n=0..1000); # Robert Israel, Jul 23 2014
MATHEMATICA
a245474[n_Integer] := Catch[
Do[
If[IntegerQ[Sqrt[(s*n - Floor[Sqrt[s*n]]^2)]] == True, Throw[s]],
{s, n}]
]; Map[a245474, Range[100]] (* Michael De Vlieger, Aug 03 2014 *)
PROG
(PARI) a(n) = s=1; while(!issquare(s*n-sqrtint(s*n)^2), s++); s \\ Colin Barker, Jul 23 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Jul 23 2014
EXTENSIONS
More terms from Colin Barker, Jul 23 2014
STATUS
approved