OFFSET
1,3
COMMENTS
a(n) = -1 if and only if n is a term in A005179.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = -1 because there is no positive number less than 1 having 1 divisor.
a(2) = -1 because 2 is the first prime.
a(3) = 2 because 2 is the greatest prime less than 3 and all primes have 2 divisors.
MATHEMATICA
a[1] = -1; a[n_] := Module[{k = n - 1, d = DivisorSigma[0, n]}, While[k > 0 && DivisorSigma[0, k] != d, k--]; If[k == 0, -1, k]]; Array[a, 100] (* Amiram Eldar, Sep 23 2021 *)
PROG
(PARI) a(n) = my(nd=numdiv(n)); forstep(k=n-1, 1, -1, if (numdiv(k)==nd, return(k))); return(-1); \\ Michel Marcus, Sep 22 2021
CROSSREFS
KEYWORD
sign
AUTHOR
David James Sycamore, Sep 22 2021
STATUS
approved