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.
%I A117120 #55 Sep 10 2020 14:29:22 %S A117120 1,2,3,5,4,7,6,11,10,9,8,15,14,13,12,23,22,21,20,19,18,17,16,31,30,29, %T A117120 28,27,26,25,24,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,63,62, %U A117120 61,60,59,58,57,56,55,54,53,52,51,50,49,48,95,94,93,92,91,90,89,88,87 %N A117120 a(1)=1. a(n) is smallest positive integer not occurring earlier in the sequence where a(n) is congruent to -1 (mod a(n-1)). %C A117120 Sequence is a permutation of the positive integers. %C A117120 The permutation is self-inverse. Except for fixed points 1, 2, 3 it consists completely of 2-cycles: (4,5), (6,7), (8,11), (9,10), (12,15), (13,14), (16,23), (17,22), ..., (24,31), ..., (32,47), ... . - _Klaus Brockhaus_ %C A117120 The permutation transforms enumeration system of positive irreducible fractions A071766/A229742 (HCS) into enumeration system A245325/A245326, and vice versa. - _Yosu Yurramendi_, Jun 09 2015 %C A117120 A092569(a(n)) = a(A092569(n)), n > 0. %C A117120 A258746(a(n)) = a(A258746(n)), n > 0. %C A117120 A258996(a(n)) = a(A258996(n)), n > 0. %C A117120 A054429(a(n)) = a(A054429(n)), n > 0. %C A117120 a(n) = A054429(A063946(n)) = A063946(A054429(n)), n > 0. - _Yosu Yurramendi_, Mar 23 2017 %H A117120 Robert Israel, <a href="/A117120/b117120.txt">Table of n, a(n) for n = 1..10000</a> %H A117120 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A117120 For n >= 2: If a(n-1) = 2^m, m=positive integer, then a(n)= 2^(m+1)-1. If a(n-1) = 3*2^m, m= nonnegative integer, then a(n) = 3*2^(m+1)-1. Otherwise, a(n) = a(n-1) -1. %F A117120 For n >= 2: a(2*n) = 2*a(n)+1, a(2*n+1) = 2*a(n). - _Yosu Yurramendi_, Jun 08 2015 %p A117120 A[1]:= 1: A[2]:= 2: B[1]:= 0: B[2]:= 0: %p A117120 for n from 3 to 100 do %p A117120 for m from A[n-1]-1 by A[n-1] while assigned(B[m]) do od: %p A117120 A[n]:= m; %p A117120 B[m]:= 0; %p A117120 od: %p A117120 seq(A[n],n=1..100); # _Robert Israel_, Jun 09 2015 %t A117120 f[n_] := Block[{a = {1}, i, k}, Do[k = 1; While[Or[Mod[k, a[[i - 1]]] != a[[i - 1]] - 1, MemberQ[a, k]], k++]; AppendTo[a, k], {i, 2, n}]; a]; f@ 120 (* _Michael De Vlieger_, Jun 11 2015 *) %t A117120 A[n_]:= If[n<4, n, If[EvenQ[n], 2A[n/2] + 1, 2A[(n - 1)/2]]]; Table[A[n], {n, 100}] (* _Indranil Ghosh_, Mar 21 2017 *) %t A117120 f[lst_List] := Block[{k = 2, m = lst[[-1]]}, While[ MemberQ[lst, k] || 1 + Mod[k, m] != m, k++]; Append[lst, k]]; Nest[f, {1}, 70] (* _Robert G. Wilson v_, Jan 22 2018 *) %o A117120 (R) %o A117120 a <- 1:3 # If it were c(1, 3, 2), it would be A054429 %o A117120 maxn <- 50 # by choice %o A117120 # %o A117120 for(n in 2:maxn){ %o A117120 a[2*n ] <- 2*a[n]+1 %o A117120 a[2*n+1] <- 2*a[n] %o A117120 } %o A117120 # %o A117120 a %o A117120 # _Yosu Yurramendi_, Jun 08 2015 %o A117120 (PARI) A(n) = if(n<4, n, if(n%2, 2*A(n\2), 2*A(n/2)+1)); %o A117120 for(n=1, 50, print1(A(n), ", ")) \\ _Indranil Ghosh_, Mar 21 2017 %Y A117120 Cf. A071766, A229742, A245325, A245326. %K A117120 easy,nonn %O A117120 1,2 %A A117120 _Leroy Quet_, Apr 19 2006 %E A117120 More terms from _Klaus Brockhaus_