cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A181831 The sum of positive integers <= n that are strongly prime to n.

This page as a plain text file.
%I A181831 #14 Dec 03 2023 08:47:34
%S A181831 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,
%T A181831 190,125,201,128,350,90,393,224,267,224,366,168,575,304,408,264,730,
%U A181831 210,807,396,456,428,1009,336,905,443
%N A181831 The sum of positive integers <= n that are strongly prime to n.
%C A181831 k is strongly prime to n iff k is relatively prime to n and k does not divide n-1.
%C A181831 a(n) = A023896(n) - A000203(n-1) if n > 1 and a(n) = 0 for n = 0,1.
%H A181831 Peter Luschny, <a href="http://www.oeis.org/wiki/User:Peter_Luschny/StrongCoprimality">Strong coprimality</a>.
%e A181831 a(11) = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 - 1 - 2 - 5 - 10 = 37.
%p A181831 with(numtheory):
%p A181831 A181831 := n -> `if`(n<2,0,n*phi(n)/2-sigma(n-1)):
%t A181831 Join[{0,0},Table[Total[Select[Range[n],CoprimeQ[#,n]&&!Divisible[n-1,#]&]],{n,2,50}]] (* _Harvey P. Dale_, Apr 09 2013 *)
%o A181831 (SageMath)
%o A181831 def isstrongprimeto(k, n): return not(k.divides(n-1)) and gcd(k, n) == 1
%o A181831 def a(n): return sum(k for k in srange(n + 1) if isstrongprimeto(k, n))
%o A181831 print([a(n) for n in range(51)])
%o A181831 # Alternative:
%o A181831 def a(n): return 0 if n < 2 else n*euler_phi(n)//2 - sigma(n - 1, 1)
%o A181831 # _Peter Luschny_, Dec 03 2023
%Y A181831 Cf. A181830, A181832, A181833, A181834, A181835, A181836, A023896, A000203.
%K A181831 nonn
%O A181831 0,6
%A A181831 _Peter Luschny_, Nov 17 2010
%E A181831 a(0) corrected by _Peter Luschny_, Dec 03 2023