Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #25 Aug 07 2018 12:16:29
%S 1,0,0,1,0,2,0,3,2,4,0,15,0,6,4,7,0,40,0,9,6,10,0,77,4,12,8,39,0,630,
%T 0,15,10,16,12,187,0,18,12,133,0,260,0,21,56,22,0,345,6,72,16,75,0,
%U 442,20,189,18,28,0,6061,0,30,40,31,12,3360,0,33,22,3978
%N a(n) = lcm_{p is a prime divisor of n} (n/p - 1).
%C n is prime if and only if a(n) = 0.
%C n is a Giuga number if and only if a(n) > 0 and n divides a(n).
%H Andrew Howroyd, <a href="/A231333/b231333.txt">Table of n, a(n) for n = 1..1000</a>
%F a(6) = 2 because 6/2 - 1 = 2 and 6/3 - 1 = 1, and the least common multiple of 2 and 1 is 2.
%F a(7) = 0 because 7/7 - 1 = 0.
%F a(8) = 3 because 8/2 - 1 = 3.
%t 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]
%o (PARI) a(n)=my(f=factor(n)[,1]); lcm(vector(#f,i,n/f[i]-1)) \\ _Charles R Greathouse IV_, Nov 13 2013
%Y Cf. A007850.
%K nonn
%O 1,6
%A _José María Grau Ribas_, Nov 07 2013