login
A181831
The sum of positive integers <= n that are strongly prime to n.
11
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,6
COMMENTS
k is strongly prime to n iff k is relatively prime to n and k does not divide n-1.
a(n) = A023896(n) - A000203(n-1) if n > 1 and a(n) = 0 for n = 0,1.
EXAMPLE
a(11) = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 - 1 - 2 - 5 - 10 = 37.
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 *)
PROG
(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
KEYWORD
nonn
AUTHOR
Peter Luschny, Nov 17 2010
EXTENSIONS
a(0) corrected by Peter Luschny, Dec 03 2023
STATUS
approved