login
Inverse permutation to A064736.
2

%I #17 Jul 13 2013 12:02:40

%S 1,2,4,6,8,3,10,12,14,16,18,5,20,22,24,26,28,30,32,7,34,36,38,40,42,

%T 44,46,48,50,52,54,56,58,60,9,62,64,66,68,70,72,74,76,78,80,82,84,86,

%U 88,90,92,94,96,98,100,11,102,104,106,108,110,112,114,116,118,120,122,124

%N Inverse permutation to A064736.

%H Reinhard Zumkeller, <a href="/A064745/b064745.txt">Table of n, a(n) for n = 1..10000</a>

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

%t max = 124; ClearAll[a, b]; A064736 = {a[1]=1, a[2]=2}; a[n_] := a[n] = (an = If[OddQ[n], a[n-1]*a[n+1], First[ Complement[ Range[n], A064736]]]; AppendTo[A064736, an]; an); Do[b[a[n]] = n, {n, 1, max}]; A064745 = Table[b[n], {n, 1, a[max]}] (* _Jean-François Alcover_, Aug 07 2012 *)

%o (Haskell)

%o import Data.List (elemIndex)

%o import Data.Maybe (fromJust)

%o a064745 n = fromJust (elemIndex n a064736_list) + 1

%o -- _Reinhard Zumkeller_, Mar 23 2012

%K nonn,easy

%O 1,2

%A _N. J. A. Sloane_, Oct 21 2001

%E More terms from _Vladeta Jovovic_, Oct 21 2001