OFFSET
2,2
COMMENTS
a(1) is not defined since 1 has fewer than 2 divisors.
n is a prime number if and only if a(n) > 0.
n is the square of a prime number if and only if a(n) = 0.
n is composite and is not the square of a prime number if and only if a(n) < 0.
If n is prime, then a(n) = n - 1,
else, if 2 divides n, then a(n) = 2 - (n / 2),
else, if 3 divides n, then a(n) = 3 - (n / 3),
else, if 5 divides n, then a(n) = 5 - (n / 5),
and so on, with infinitely many statements of the
"else, if p divides n, then a(n) = p - (n / p)," kind, over all p, prime numbers.
LINKS
Michel Marcus, Table of n, a(n) for n = 2..1000
EXAMPLE
The divisors of 7 are { 1, 7 }. Then a(7) = 7 - 1 = 6.
The divisors of 25 are { 1, 5, 25 }. Then a(25) = 5 - 5 = 0.
The divisors of 221 are { 1, 13, 17, 221 }. Then a(221) = 13 - 17 = -4.
PROG
(PARI) a(n)={my(T=divisors(n)); T[2]-T[#T-1]}
CROSSREFS
KEYWORD
sign
AUTHOR
Luc Rousseau, Jun 26 2017
STATUS
approved