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!)
A121216 a(1)=1, a(2) = 2; thereafter a(n) = the smallest positive integer which does not occur earlier in the sequence and which is coprime to a(n-2). 24

%I #38 May 07 2022 15:17:41

%S 1,2,3,5,4,6,7,11,8,9,13,10,12,17,19,14,15,23,16,18,21,25,20,22,27,29,

%T 26,24,31,35,28,32,33,37,34,30,39,41,38,36,43,47,40,42,49,53,44,45,51,

%U 46,50,55,57,48,52,59,61,54,56,65,67,58,60,63,71,62,64,69,73,68,66,75

%N a(1)=1, a(2) = 2; thereafter a(n) = the smallest positive integer which does not occur earlier in the sequence and which is coprime to a(n-2).

%C Permutation of the positive natural numbers with inverse A225047: a(A225047(n)) = A225047(a(n)) = n. - _Reinhard Zumkeller_, Apr 25 2013

%C I confirm that this is a permutation. - _N. J. A. Sloane_, Mar 28 2015 [This can be proved using an argument similar to (but simpler than) the proof in A093714. - _N. J. A. Sloane_, May 05 2022]

%H Reinhard Zumkeller, <a href="/A121216/b121216.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 Nest[Append[#, Block[{k = 3}, While[Nand[FreeQ[#, k], GCD[#[[-2]], k] == 1], k++]; k]] &, {1, 2}, 70] (* _Michael De Vlieger_, Dec 26 2019 *)

%o (Haskell)

%o import Data.List (delete, (\\))

%o a121216 n = a121216_list !! (n-1)

%o a121216_list = 1 : 2 : f 1 2 [3..] where

%o f x y zs = g zs where

%o g (u:us) = if gcd x u == 1 then h $ delete u zs else g us where

%o h (v:vs) = if gcd y v == 1 then u : v : f u v (zs \\ [u,v]) else h vs

%o -- _Reinhard Zumkeller_, Apr 25 2013

%Y Cf. A084937, A121217, A225047, A098550, A256219 (positions of primes), A256399.

%Y See also A352933, A352934, A352935, A352936, A352937, A353705, A353707, A353708.

%K nonn

%O 1,2

%A _Leroy Quet_, Aug 20 2006

%E Extended by _Ray Chandler_, Aug 22 2006

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 April 24 15:18 EDT 2024. Contains 371960 sequences. (Running on oeis4.)