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 A065652 #13 Mar 19 2025 08:34:12 %S A065652 0,1,2,5,4,3,10,9,8,7,6,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23, %T A065652 22,21,20,19,18,17,16,15,14,13,12,11,122,121,120,119,118,117,116,115, %U A065652 114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98,97 %N A065652 a(0) = 0 and a(n+1) = if a(n) - 1 is new and > 0 then a(n) - 1 else a(n)*a(n) + 1 for n >= 0. %C A065652 a(a(n)) = n: a self-inverse permutation of the natural numbers. a(x) = x iff x = A065654(k) for some k. %H A065652 Amiram Eldar, <a href="/A065652/b065652.txt">Table of n, a(n) for n = 0..10000</a> %H A065652 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>. %F A065652 a(A065653(k) + j) = A065653(k+1) - 1 - j for k >= 0 and 0 <= j < A065653(k+1) - A065653(k). %t A065652 a[n_] := a[n] = If[a[n - 1] > 1 && FreeQ[Array[a, n, 0], a[n - 1] - 1], a[n - 1] - 1, a[n - 1]^2 + 1]; a[0] = 0; Array[a, 100, 0] (* _Amiram Eldar_, Mar 19 2025 *) %Y A065652 Cf. A065653, A065654. %K A065652 nonn %O A065652 0,3 %A A065652 _Reinhard Zumkeller_, Nov 10 2001