%I #24 Jan 30 2024 09:45:43
%S 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 44,17,47,49,19,52,20,55,57,22,60,62,24,65,25,68,70,27,73,75,29,78,30,
%U 81,83,32,86,33,89,91,35,94,96,37,99,38,102,104,40,107,109
%N A permutation of the positive integers with a divisibility property (see Comments for precise definition).
%C 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 Alois P. Heinz, <a href="/A340510/b340510.txt">Table of n, a(n) for n = 1..10000</a>
%H 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 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 Theorem 1 of Avdispahić and Zejnulahi gives an explicit formula involving Fibonacci numbers.
%p A000045_inv := proc(n)
%p local k ;
%p for k from 0 do
%p if combinat[fibonacci](k) = n then
%p return k;
%p elif combinat[fibonacci](k) > n then
%p return -1;
%p end if;
%p end do:
%p end proc:
%p A000071_inv := proc(n)
%p local k ;
%p for k from 0 do
%p if combinat[fibonacci](k)-1 = n then
%p return k;
%p elif combinat[fibonacci](k)-1 > n then
%p return -1;
%p end if;
%p end do:
%p end proc:
%p A000201_inv := proc(n)
%p local k,w ;
%p for k from 1 do
%p w := floor(k*(1+sqrt(5))/2) ;
%p if w = n then
%p return k;
%p elif w > n then
%p return -1;
%p end if;
%p end do:
%p end proc:
%p A001950_inv := proc(n)
%p local k,w ;
%p for k from 1 do
%p w := floor(k*(3+sqrt(5))/2) ;
%p if w = n then
%p return k;
%p elif w > n then
%p return -1;
%p end if;
%p end do:
%p end proc:
%p A340510 := proc(n)
%p local k ;
%p if n = 1 then
%p 1;
%p else
%p k := A000045_inv(n) ;
%p if k > 2 then
%p return combinat[fibonacci](k+1) ;
%p end if;
%p k := A000071_inv(n) ;
%p if k > 4 then
%p return combinat[fibonacci](k-1)-1 ;
%p end if;
%p k := A000201_inv(n) ;
%p if k > 0 then
%p return floor(k*(3+sqrt(5))/2) ;
%p end if;
%p k := A001950_inv(n) ;
%p return floor(k*(1+sqrt(5))/2) ;
%p end if;
%p end proc:
%p seq(A340510(n),n=1..50) ; # _R. J. Mathar_, Jan 30 2024
%t 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 Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* _Jean-François Alcover_, Jan 31 2021 *)
%Y Cf. A000045, A001622, A019444.
%K nonn,hear
%O 1,2
%A _N. J. A. Sloane_, Jan 28 2021
%E More terms from _Alois P. Heinz_, Jan 28 2021
|