OFFSET
1,3
COMMENTS
If a(2k) = 3, then 4k^2 + 1 = 3p with p prime. For odd n > 1, a(n) >= 2, with equality if (n^2+1)/2 is prime. Conversely, A147809(n) = 1 iff n^2 + 1 is a semiprime, which for odd n > 1 implies a(n) = 2.
a(1) = 1 by convention, which is compatible with the FORMULA (a(n) = 1 iff n^2 + 1 is prime) and also with a(n) = the floor(d/2)-th divisor of n^2+1, when d is its total number of divisors, cf. PROGRAM. - M. F. Hasler, Sep 11 2019
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = 1 iff n^2 + 1 is prime (iff A147809(n)=0), which can only happen for n = 1 or even n.
MATHEMATICA
a[1] = 1; a[n_] := Max[Select[Divisors[n^2 + 1], # < n &]]; Array[a, 100] (* Amiram Eldar, Sep 12 2019 *)
PROG
(PARI) A152823(n)={ n=divisors(n^2+1); n[ #n\2] }
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Dec 15 2008
STATUS
approved