OFFSET
1,6
COMMENTS
n is prime if and only if a(n) = 0.
n is a Giuga number if and only if a(n) > 0 and n divides a(n).
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..1000
FORMULA
a(6) = 2 because 6/2 - 1 = 2 and 6/3 - 1 = 1, and the least common multiple of 2 and 1 is 2.
a(7) = 0 because 7/7 - 1 = 0.
a(8) = 3 because 8/2 - 1 = 3.
MATHEMATICA
lcm[lis_] := {aux = 1; Do[aux = LCM[aux, lis[[i]]], {i, 1, Length[lis]}]; aux}[[1]]; fa = FactorInteger; j[n_] := lcm@Table[n/fa[n][[i, 1]] - 1, {i, 1, Length[fa[n]]}] ; Array[j, 100]
PROG
(PARI) a(n)=my(f=factor(n)[, 1]); lcm(vector(#f, i, n/f[i]-1)) \\ Charles R Greathouse IV, Nov 13 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
José María Grau Ribas, Nov 07 2013
STATUS
approved