A128248 a(n) = Sum_{k=1..phi(n)} t(k,n)*(-1)^k, where t(k,n) is the k-th positive integer that is coprime to n and phi(n) = A000010(n).
-1, -1, 1, 2, 2, 4, 3, 4, 3, 4, 5, 8, 6, 8, 8, 8, 8, 12, 9, 8, 8, 12, 11, 16, 10, 12, 9, 16, 14, 16, 15, 16, 16, 16, 16, 24, 18, 20, 16, 16, 20, 16, 21, 24, 24, 24, 23, 32, 21, 20, 24, 24, 26, 36, 24, 32, 24, 28, 29, 32, 30, 32, 24, 32, 32, 32, 33, 32, 32, 32, 35, 48, 36, 36, 40, 40, 40, 32, 39, 32, 27, 40, 41, 32, 40, 44, 40, 48, 44, 48, 48
Offset: 1
Keywords
Examples
The positive integers which are <= 10 and are coprime to 10 are 1,3,7,9. So a(10) = -1 + 3 - 7 + 9 = 4.
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Maple
with(numtheory): t:=proc(k,n) local A,i: A:={}: for i from 1 while nops(A)<=k do if igcd(i,n)=1 then A:=A union {i} else A:=A: fi od: A[k] end: a:=n->add((-1)^k*t(k,n),k=1..phi(n)): seq(a(n),n=1..100); # Emeric Deutsch, May 06 2007
-
Mathematica
Table[Total[Times@@@Partition[Riffle[Select[Range[n],CoprimeQ[#,n]&],{-1,1},{2,-1,2}],2]],{n,100}] (* Harvey P. Dale, May 05 2013 *)
Extensions
More terms from Emeric Deutsch, May 06 2007
Comments