login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A054430
Simple self-inverse permutation of natural numbers: List each clump of phi(n) numbers (starting from phi(2) = 1) in reverse order.
2
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,2
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 *)
PROG
(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
CROSSREFS
Maps fractions between A020652/A020653 and A020653/A020652.
See also A054429.
Sequence in context: A296007 A277437 A339380 * A276572 A363370 A330311
KEYWORD
nonn,easy
STATUS
approved