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.

A054430 Simple self-inverse permutation of natural numbers: List each clump of phi(n) numbers (starting from phi(2) = 1) in reverse order.

Original entry on oeis.org

1, 3, 2, 5, 4, 9, 8, 7, 6, 11, 10, 17, 16, 15, 14, 13, 12, 21, 20, 19, 18, 27, 26, 25, 24, 23, 22, 31, 30, 29, 28, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 45, 44, 43, 42, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 63, 62, 61, 60, 59, 58, 71, 70, 69, 68, 67, 66, 65, 64, 79
Offset: 1

Views

Author

Keywords

Crossrefs

Maps fractions between A020652/A020653 and A020653/A020652.
See also A054429.

Programs

  • Maple
    ReverseNextPhi_n_elements_permutation(30); with(numtheory,phi); ReverseNextPhi_n_elements_permutation := proc(u) local m,a,n,k,i; a := []; k := 0; for n from 2 to u do m := k + phi(n); for i from 1 to phi(n) do a := [op(a),m]; m := m-1; k := k+1; od; od; RETURN(a); end;
  • Mathematica
    A[u_]:=Block[{m, a={}, n, k=0, i}, For[n=2, n<=u, n++, m=k + EulerPhi[n]; For[i=1, i<=EulerPhi[n], i++, AppendTo[a, m]; m=m - 1; k = k + 1]]; Return [a]]; A[30] (* Indranil Ghosh, May 23 2017, translated from MAPLE code *)
    Reverse/@TakeList[Range[200],EulerPhi[Range[2,20]]]//Flatten (* Harvey P. Dale, Oct 19 2022 *)
  • Python
    from sympy import totient
    def A(u):
        a=[]
        k=0
        for n in range(2, u + 1):
            m=k + totient(n)
            for i in range(1, totient(n) + 1):
                a+=[m,]
                m-=1
                k+=1
        return a
    print(A(30)) # Indranil Ghosh, May 23 2017, translated from MAPLE code