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.

Original entry on oeis.org

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

Views

Author

Peter Luschny, Nov 17 2010

Keywords

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.

Examples

			a(11) = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 - 1 - 2 - 5 - 10 = 37.
		

Crossrefs

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