A292286 a(n) = k if the product of the divisors of n is n^k for some integer k, or -1 if no such k exists. For the ambiguous case, define a(1) = 0.
0, 1, 1, -1, 1, 2, 1, 2, -1, 2, 1, 3, 1, 2, 2, -1, 1, 3, 1, 3, 2, 2, 1, 4, -1, 2, 2, 3, 1, 4, 1, 3, 2, 2, 2, -1, 1, 2, 2, 4, 1, 4, 1, 3, 3, 2, 1, 5, -1, 3, 2, 3, 1, 4, 2, 4, 2, 2, 1, 6, 1, 2, 3, -1, 2, 4, 1, 3, 2, 4, 1, 6, 1, 2, 3, 3, 2, 4, 1, 5, -1, 2, 1, 6, 2, 2, 2, 4, 1, 6, 2, 3, 2, 2, 2, 6, 1, 3, 3, -1
Offset: 1
Keywords
Examples
a(10) = 2 because divisors of 10 are 1,2,5,10 with product 100 = 10^2.
Links
Crossrefs
Programs
-
Mathematica
Table[Boole[n == 1] + If[OddQ@ #, -1, #/2] &@ DivisorSigma[0, n], {n, 100}] (* Michael De Vlieger, Sep 15 2017 *)
-
PARI
a(n) = if (n==1, 0, my(nd = numdiv(n)); if (nd % 2, -1, nd/2)); \\ Michel Marcus, Sep 14 2017
-
PARI
a(n)=my(k=numdiv(n)); if(k%2, if(n>1, -1, 0), k/2) \\ Charles R Greathouse IV, Sep 19 2017
Formula
Extensions
Definition corrected by Charles R Greathouse IV, Sep 13 2017
Comments