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.

Showing 1-2 of 2 results.

A235384 Number of involutions in the group Aff(Z/nZ).

Original entry on oeis.org

2, 4, 6, 6, 8, 8, 16, 10, 12, 12, 24, 14, 16, 24, 28, 18, 20, 20, 36, 32, 24, 24, 64, 26, 28, 28, 48, 30, 48, 32, 52, 48, 36, 48, 60, 38, 40, 56, 96, 42, 64, 44, 72, 60, 48, 48, 112, 50, 52, 72, 84, 54, 56, 72, 128, 80, 60, 60, 144, 62, 64, 80, 100, 84
Offset: 2

Views

Author

Tom Edgar, Jan 08 2014

Keywords

Comments

Aff(Z/nZ) is the group of functions on Z/nZ of the form x->ax+b where a and b are elements of Z/nZ and gcd(a,n)=1.
Since Aff(Z/nZ) is isomorphic to the automorphism group of the dihedral group with 2n elements (when n>=3), this is the number of automorphisms of the dihedral group with 2n elements that have order 1 or 2.
The sequence is multiplicative: a(k*m) = a(k)*a(m) if m and k are coprime.
When n=26, this is the number of affine ciphers where encryption and decryption use the same function.

Examples

			Since 18 = 2*3^2, we get a(18) = 2*(3^2+1) = 20. Since 120 = 2^3*3*5, we have a(120) = (4+2^2+2^3)*(3+1)*(5+1) = 384.
		

Crossrefs

Programs

  • Maple
    a:= n-> add(`if`(irem(k^2, n)=1, igcd(n, k+1), 0), k=1..n-1):
    seq(a(n), n=2..100);  # Alois P. Heinz, Jan 20 2014
  • Mathematica
    a[n_] := Sum[If[Mod[k^2, n] == 1, GCD[n, k+1], 0], {k, 1, n-1}]; Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Mar 24 2014, after Alois P. Heinz *)
    f[p_, e_] := p^e + 1; f[2, 1] = 2; f[2, 2] = 6; f[2, e_] := 3*2^(e - 1) + 4; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100, 2]  (* Amiram Eldar, Dec 05 2022 *)
  • PARI
    A034448(n,f=factor(n))=factorback(vector(#f~,i,f[i,1]^f[i,2]+1))
    a(n)=my(m=valuation(n,2)); if(m==0,1,m==1,2,m==2,6,4+3<<(m-1))*A034448(n>>m) \\ Charles R Greathouse IV, Jul 29 2016
  • Sage
    def a(n):
        L=list(factor(n))
        if L[0][0]==2:
            m=L[0][1]
            L.pop(0)
        else:
            m=0
        order=prod([x[0]^x[1]+1 for x in L])
        if m==1:
            order=2*order
        elif m==2:
            order=6*order
        elif m>=3:
            order=(4+2^(m-1)+2^m)*order
        return order
    [a(i) for i in [2..100]]
    
  • Sage
    def b(n):
        sum = 0
        for a in [x for x in range(n) if ((x^2) % n == 1)]:
            sum += gcd(a+1,n)
        return sum
    [b(i) for i in [2..100]]
    

Formula

Suppose n = 2^m*p_1^(r_1)*p_2^(r_2)*...*p_k^(r_k) where each p_i>2 is prime, r_i>0 for all i, and m>=0 is the prime factorization of n, then:
...a(n) = Product_{1<=i<=k} (p_i^(r_i)+1) if m=0,
...a(n) = 2*Product_{1<=i<=k} (p_i^(r_i)+1) if m=1,
...a(n) = 6*Product_{1<=i<=k} (p_i^(r_i)+1) if m=2,
...a(n) = (4+2^(m-1)+2^m)*Product_{1<=i<=k} (p_i^(r_i)+1) if m>=3.
a(n) = Sum_{a in row(n) of A228179} gcd(a+1,n).
Sum_{k=1..n} a(k) ~ c * n^2, where c = zeta(2)/(2*zeta(3)) = 0.684216... (A335005). - Amiram Eldar, Dec 05 2022

A343442 If n = Product (p_j^k_j) then a(n) = Product (p_j + 2), with a(1) = 1.

Original entry on oeis.org

1, 4, 5, 4, 7, 20, 9, 4, 5, 28, 13, 20, 15, 36, 35, 4, 19, 20, 21, 28, 45, 52, 25, 20, 7, 60, 5, 36, 31, 140, 33, 4, 65, 76, 63, 20, 39, 84, 75, 28, 43, 180, 45, 52, 35, 100, 49, 20, 9, 28, 95, 60, 55, 20, 91, 36, 105, 124, 61, 140, 63, 132, 45, 4, 105, 260, 69, 76, 125, 252
Offset: 1

Views

Author

Ilya Gutkovskiy, Apr 15 2021

Keywords

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := Times @@ ((#[[1]] + 2) & /@ FactorInteger[n]); Table[a[n], {n, 70}]
    nmax = 70; CoefficientList[Series[Sum[MoebiusMu[k]^2 DivisorSigma[1, k] x^k/(1 - x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
  • PARI
    a(n) = sumdiv(n, d, moebius(d)^2 * sigma(d)) \\ Andrew Howroyd, Apr 15 2021

Formula

G.f.: Sum_{k>=1} mu(k)^2 * sigma(k) * x^k / (1 - x^k), where mu = A008683 and sigma = A000203.
a(n) = Sum_{d|n} mu(d)^2 * sigma(d).
Sum_{k=1..n} a(k) ~ c * n^2, where c = Pi^2/(12*zeta(3)) = 0.684216... (A335005). - Amiram Eldar, Nov 13 2022
a(n) = Sum_{d|n} mu(d)^2*psi(d), where psi is A001615. - Ridouane Oudra, Jul 24 2025
Showing 1-2 of 2 results.