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 A125717 #75 Mar 21 2025 02:26:05 %S A125717 0,1,3,6,2,7,13,20,4,22,12,23,11,24,10,25,9,26,8,27,47,5,49,72,48,73, %T A125717 21,75,19,77,17,79,15,81,115,45,117,43,119,41,121,39,123,37,125,35, %U A125717 127,33,129,31,131,29,133,80,134,189,245,74,16,193,253,70,132,69,197,67,199,65 %N A125717 a(0)=0; thereafter a(n) = the smallest nonnegative integer not already in the sequence such that a(n-1) is congruent to a(n) (mod n). %C A125717 This sequence seems likely to be a permutation of the nonnegative integers. %C A125717 A245340(n) = smallest m such that a(m) = n, or -1 if n never appears. %C A125717 See A245394 and A245395 for record values of a(n) and where they occur. - _Reinhard Zumkeller_, Jul 21 2014 %C A125717 See A370956 and A370959 for record values of the inverse A245340 and where they occur. - _N. J. A. Sloane_, Apr 29 2024 %C A125717 A very nice (maybe the most natural) variant of Recamán's sequence A005132. - _M. F. Hasler_, Nov 03 2014 %H A125717 Reinhard Zumkeller, <a href="/A125717/b125717.txt">Table of n, a(n) for n = 0..100000</a> (first 10000 terms from Ferenc Adorján) %H A125717 Ferenc Adorján, <a href="https://web.archive.org/web/20210629063154/http://web.t-online.hu/fadorjan/l_quet.pdf">Some characteristics of Leroy Quet's permutation sequences</a> %H A125717 N. J. A. Sloane, <a href="/A125717/a125717.jpg">Log-log plot of A370956 vs A370959</a> (shows terms in A125717 that take the longest to appear). %H A125717 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a> %H A125717 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %t A125717 f[l_List] := Block[{n = Length[l], k = Mod[l[[ -1]], n]},While[MemberQ[l, k], k += n];Append[l, k]];Nest[f, {0}, 70] (* _Ray Chandler_, Feb 04 2007, updated for change to offset Oct 10 2019 *) %o A125717 (PARI) {Quet_p2(n)=/* Permutation sequence a'la _Leroy Quet_, A125717 */local(x=[1],k=0,w=1); for(i=2,n,if((k=x[i-1]%i)==0,k=i);while(bittest(w,k-1)>0,k+=i);x=concat(x,k);w+=2^(k-1)); return(x)} \\ Ferenc Adorjan %o A125717 (Haskell) %o A125717 import Data.IntMap (singleton, member, (!), insert) %o A125717 a125717 n = a125717_list !! n %o A125717 a125717_list = 0 : f [1..] 0 (singleton 0 0) where %o A125717 f (v:vs) w m = g (reverse[w-v,w-2*v..1] ++ [w+v,w+2*v..]) where %o A125717 g (x:xs) = if x `member` m then g xs else x : f vs x (insert x v m) %o A125717 -- _Reinhard Zumkeller_, Jul 21 2014 %o A125717 (PARI) A125717(n,show=0)={my(u=1,a);for(n=1,n,a%=n;while(bittest(u,a),a+=n);u+=1<<a;show&&print1(a","));a} \\ _M. F. Hasler_, Nov 03 2014 %o A125717 (Python) %o A125717 from itertools import count, islice %o A125717 def agen(): # generator of terms %o A125717 an, aset = 0, {0} %o A125717 for n in count(1): %o A125717 yield an %o A125717 an = next(m for m in count(an%n, n) if m not in aset) %o A125717 aset.add(an) %o A125717 print(list(islice(agen(), 70))) # _Michael S. Branicky_, Jun 07 2023 %Y A125717 Cf. A245340 (inverse), A370957 (first differences), A245394 & A245395 (records in this sequence), A370956 & A370959 (records in inverse). %Y A125717 See also A005132 (Recaman), A099506, A125715, A125718, A125725. %K A125717 nonn,nice,look %O A125717 0,3 %A A125717 _Leroy Quet_, Feb 01 2007 %E A125717 Extended by _Ray Chandler_, Feb 04 2007 %E A125717 a(0) added by _Franklin T. Adams-Watters_, Mar 31 2014 %E A125717 Edited by _N. J. A. Sloane_, Mar 15 2024