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 A367065 #38 Dec 16 2023 14:14:35 %S A367065 2,4,1,7,9,3,12,14,5,17,6,20,22,8,25,27,10,30,11,33,35,13,38,40,15,43, %T A367065 16,46,48,18,51,19,54,56,21,59,61,23,64,24,67,69,26,72,74,28,77,29,80, %U A367065 82,31,85,32,88,90,34,93,95,36,98,37,101,103,39,106,108,41,111,42,114 %N A367065 a(1)=2, thereafter a(n) is the least positive integer not yet in the sequence such that Sum_{i=1..n} a(i) == 2 (mod n+2). %C A367065 This is the Avdispahić-Zejnulahi sequence AZ(2). For a positive integer k, the Avdispahić-Zejnulahi sequence AZ(k) is given by: a(1)=k, thereafter a(n) is the least positive integer not yet in the sequence such that Sum_{i=1..n} a(i) == k (mod n+k). It is interesting to note that (AZ(k)) represents a sequence of permutations of the set of positive integers. (See Links section for details concerning AZ(1).) %H A367065 Muharem Avdispahić and Faruk Zejnulahi, <a href="https://www.researchgate.net/publication/341726940_AN_INTEGER_SEQUENCE_WITH_A_DIVISIBILITY_PROPERTY">An integer sequence with a divisibility property</a>, Fibonacci Quarterly, Vol. 58:4 (2020), 321-333. %H A367065 Jeffrey Shallit, <a href="https://arxiv.org/abs/2308.06544">Proving properties of some greedily-defined integer recurrences via automata theory</a>, arXiv:2308.06544 [cs.DM], 2023. %t A367065 lst={2}; f[s_List]:=Block[{k=1,len=3+Length@lst,t=Plus@@lst},While[MemberQ[s,k]||Mod[k+t,len]!=2,k++]; AppendTo[lst,k]]; Nest[f,lst,100] %o A367065 (Python) %o A367065 z_list = [-1, 2, 4] %o A367065 m_list = [-1, 0, 1] %o A367065 n = 2 %o A367065 for n in range(2, 100): %o A367065 if m_list[n] in z_list: %o A367065 m_list.append(m_list[n] + 1) %o A367065 z_list.append(m_list[n+1] + n+2) %o A367065 else: %o A367065 m_list.append(m_list[n]) %o A367065 z_list.append(m_list[n+1]) %o A367065 print(z_list[1:]) %Y A367065 A340510 is the AZ(1) sequence. A002251 is the AZ(0) sequence. %K A367065 nonn %O A367065 1,1 %A A367065 _Zenan Sabanac_, Nov 03 2023