login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A054430 Simple self-inverse permutation of natural numbers: List each clump of phi(n) numbers (starting from phi(2) = 1) in reverse order. 2

%I #20 Oct 19 2022 08:59:48

%S 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,

%T 22,31,30,29,28,41,40,39,38,37,36,35,34,33,32,45,44,43,42,57,56,55,54,

%U 53,52,51,50,49,48,47,46,63,62,61,60,59,58,71,70,69,68,67,66,65,64,79

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

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%p 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;

%t 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 *)

%t Reverse/@TakeList[Range[200],EulerPhi[Range[2,20]]]//Flatten (* _Harvey P. Dale_, Oct 19 2022 *)

%o (Python)

%o from sympy import totient

%o def A(u):

%o a=[]

%o k=0

%o for n in range(2, u + 1):

%o m=k + totient(n)

%o for i in range(1, totient(n) + 1):

%o a+=[m,]

%o m-=1

%o k+=1

%o return a

%o print(A(30)) # _Indranil Ghosh_, May 23 2017, translated from MAPLE code

%Y Maps fractions between A020652/A020653 and A020653/A020652.

%Y See also A054429.

%K nonn,easy

%O 1,2

%A _Antti Karttunen_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 18:04 EDT 2024. Contains 371254 sequences. (Running on oeis4.)