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 A340510 #24 Jan 30 2024 09:45:43 %S A340510 1,3,5,2,8,10,4,13,15,6,18,7,21,23,9,26,28,11,31,12,34,36,14,39,41,16, %T A340510 44,17,47,49,19,52,20,55,57,22,60,62,24,65,25,68,70,27,73,75,29,78,30, %U A340510 81,83,32,86,33,89,91,35,94,96,37,99,38,102,104,40,107,109 %N A340510 A permutation of the positive integers with a divisibility property (see Comments for precise definition). %C A340510 a(1)=1; thereafter a(n) is the least positive number not yet in the sequence such that Sum_{i=1..n} a(i) == 1 mod n+1. %H A340510 Alois P. Heinz, <a href="/A340510/b340510.txt">Table of n, a(n) for n = 1..10000</a> %H A340510 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 A340510 J. 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], August 12 2023. %F A340510 Theorem 1 of Avdispahić and Zejnulahi gives an explicit formula involving Fibonacci numbers. %p A340510 A000045_inv := proc(n) %p A340510 local k ; %p A340510 for k from 0 do %p A340510 if combinat[fibonacci](k) = n then %p A340510 return k; %p A340510 elif combinat[fibonacci](k) > n then %p A340510 return -1; %p A340510 end if; %p A340510 end do: %p A340510 end proc: %p A340510 A000071_inv := proc(n) %p A340510 local k ; %p A340510 for k from 0 do %p A340510 if combinat[fibonacci](k)-1 = n then %p A340510 return k; %p A340510 elif combinat[fibonacci](k)-1 > n then %p A340510 return -1; %p A340510 end if; %p A340510 end do: %p A340510 end proc: %p A340510 A000201_inv := proc(n) %p A340510 local k,w ; %p A340510 for k from 1 do %p A340510 w := floor(k*(1+sqrt(5))/2) ; %p A340510 if w = n then %p A340510 return k; %p A340510 elif w > n then %p A340510 return -1; %p A340510 end if; %p A340510 end do: %p A340510 end proc: %p A340510 A001950_inv := proc(n) %p A340510 local k,w ; %p A340510 for k from 1 do %p A340510 w := floor(k*(3+sqrt(5))/2) ; %p A340510 if w = n then %p A340510 return k; %p A340510 elif w > n then %p A340510 return -1; %p A340510 end if; %p A340510 end do: %p A340510 end proc: %p A340510 A340510 := proc(n) %p A340510 local k ; %p A340510 if n = 1 then %p A340510 1; %p A340510 else %p A340510 k := A000045_inv(n) ; %p A340510 if k > 2 then %p A340510 return combinat[fibonacci](k+1) ; %p A340510 end if; %p A340510 k := A000071_inv(n) ; %p A340510 if k > 4 then %p A340510 return combinat[fibonacci](k-1)-1 ; %p A340510 end if; %p A340510 k := A000201_inv(n) ; %p A340510 if k > 0 then %p A340510 return floor(k*(3+sqrt(5))/2) ; %p A340510 end if; %p A340510 k := A001950_inv(n) ; %p A340510 return floor(k*(1+sqrt(5))/2) ; %p A340510 end if; %p A340510 end proc: %p A340510 seq(A340510(n),n=1..50) ; # _R. J. Mathar_, Jan 30 2024 %t A340510 a[n_] := a[n] = Switch[n, 1, 1, 2, 3, 3, 5, 4, 2, _, Module[{aa, ss, dd, an}, aa = Array[a, n-1]; ss = Sort[aa]; dd = Differences[ss]; For[an = Select[Transpose[{Rest[ss], dd}], #[[2]] == 1 &][[-1, 1]]+1, True, an++, If[FreeQ[aa = Array[a, n-1], an], If[Mod[Total[aa] + an, n+1] == 1, Return[an]]]]]]; %t A340510 Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* _Jean-François Alcover_, Jan 31 2021 *) %Y A340510 Cf. A000045, A001622, A019444. %K A340510 nonn,hear %O A340510 1,2 %A A340510 _N. J. A. Sloane_, Jan 28 2021 %E A340510 More terms from _Alois P. Heinz_, Jan 28 2021