

A301941


a(n) is the smallest positive integer k such that n + k divides n^2 + k, or 0 if no such k exists.


1



1, 1, 0, 3, 2, 5, 4, 7, 6, 3, 5, 11, 10, 13, 12, 6, 4, 17, 16, 19, 18, 7, 11, 23, 22, 5, 24, 12, 8, 29, 28, 31, 30, 11, 17, 35, 6, 37, 36, 18, 12, 41, 40, 43, 42, 10, 23, 47, 46, 7, 20, 24, 16, 53, 52, 11, 14, 19, 29, 59, 58, 61, 60, 30, 8, 15, 12, 67, 66, 23, 35, 71, 70, 73, 72, 36, 19, 56, 13, 79, 78, 9, 41, 83, 82, 17, 84
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,4


COMMENTS

If even n > 2, such positive k exists and a(n) <= n  2 since n^2 + n  2 = (n + 2)*(n  1) is divisible by n + n  2 = 2*(n  1). Additionally, a(2) = 0 because such positive k does not exist. So a(n) <= n  2 for even positive n.
1 <= a(n) <= n for odd n, in particular, a(p) = p if p is an odd prime and it is also possible that a(t) = t for some composite t. Composite numbers t such that a(t) = t are 35, 95, 119, 143, 203, 215, 247, 275, 299, 335, 395, 403, 437, ...
From Robert Israel, Mar 29 2018: (Start)
If n>=1 is a square, then a(n) = sqrt(n).
If n is not a square but 8*n+1 is a square, then f(n) = (sqrt(8*n+1)+1)/2.
If n>=3 and neither n nor 8*n+1 is a square, then a(n) > sqrt(3*n+1).
For n>=3, n and a(n) are not coprime. (End)


LINKS

Altug Alkan, Table of n, a(n) for n = 0..10000


EXAMPLE

a(2) = 0 because there is no positive k such that k + 2 divides k + 4.
a(15) = 6 because 15 + 6 = 3*7 divides 15^2 + 6 = 3*7*11 and 6 is the least positive integer with this property.


MAPLE

f:= proc(n) local k;
if issqr(n) then return sqrt(n) fi;
for k from ceil(sqrt(2*n)) do if (n^2+k) mod (n+k) = 0 then return k fi od
end proc:
f(2):= 0: f(0):= 1:
map(f, [$0..100]); # Robert Israel, Mar 29 2018


PROG

(PARI) a(n) = {if(n==2, 0, if(isprime(n), n, my(k=1); while((n^2+k) % (n+k) != 0, k++); k; ))}


CROSSREFS

Cf. A053626.
Sequence in context: A194869 A191736 A297208 * A135762 A066250 A066251
Adjacent sequences: A301938 A301939 A301940 * A301942 A301943 A301944


KEYWORD

nonn,easy,look


AUTHOR

Altug Alkan, Mar 29 2018


STATUS

approved



