A181831 The sum of positive integers <= n that are strongly prime to n.
0, 0, 0, 0, 0, 3, 0, 9, 8, 12, 7, 37, 12, 50, 28, 36, 40, 105, 36, 132, 60, 84, 78, 217, 72, 190, 125, 201, 128, 350, 90, 393, 224, 267, 224, 366, 168, 575, 304, 408, 264, 730, 210, 807, 396, 456, 428, 1009, 336, 905, 443
Offset: 0
Keywords
Examples
a(11) = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 - 1 - 2 - 5 - 10 = 37.
Links
- Peter Luschny, Strong coprimality.
Programs
-
Maple
with(numtheory): A181831 := n -> `if`(n<2,0,n*phi(n)/2-sigma(n-1)):
-
Mathematica
Join[{0,0},Table[Total[Select[Range[n],CoprimeQ[#,n]&&!Divisible[n-1,#]&]],{n,2,50}]] (* Harvey P. Dale, Apr 09 2013 *)
-
SageMath
def isstrongprimeto(k, n): return not(k.divides(n-1)) and gcd(k, n) == 1 def a(n): return sum(k for k in srange(n + 1) if isstrongprimeto(k, n)) print([a(n) for n in range(51)]) # Alternative: def a(n): return 0 if n < 2 else n*euler_phi(n)//2 - sigma(n - 1, 1) # Peter Luschny, Dec 03 2023
Extensions
a(0) corrected by Peter Luschny, Dec 03 2023
Comments