%I #18 Aug 07 2016 22:26:59
%S 0,1,2,5,3,11,4,32,6,33,7,51,8,92,9,139,10,22,12,227,13,20,14,370,15,
%T 36,16,602,17,75,18,978,19,120,21,1586,23,2583,24,4169,25,202,26,6752,
%U 27,10939,28,29,327,30,31,34,35,539,37,38,39,40,934,41,42,56,43
%N a(0)=0; for n > 0, a(n) is the least number not yet used having the property that a(n) added to the next n+1 terms is a Fibonacci number.
%C The sequence a(n) is a permutation of the nonnegative integers.
%C The corresponding Fibonacci numbers are 1, 8, 21, 55, 89, 144, 233, 377, 377, 610, 610, 987, 987, 1597, 1597, 2584, 2584, 4181, 6765, 10946, 10946, 17711, 28657, 28657, 28657, 28657, 28657,...
%e Let F(n) the n-th Fibonacci number.
%e a(0)= 0 added to the next single term 1 is equal to F(1)=F(2)=1;
%e a(1)= 1 added to the next two terms (2,5) is equal to F(6)=8;
%e a(2)= 2 added to the next three terms (5,3,11) is equal to F(7)=21;
%e a(3)= 5 added to the next four terms (3,11,4,32) is equal to F(10)=55;
%e a(4)= 3 added to the next five terms (11,4,32,6,33) is equal to F(11)=89.
%p nn:=300:T:=array(1..nn):T[1]:=0:T[1]:=1:kk:=2:lst:={0, 1}:
%p for n from 2 to nn do:
%p ii:=0:
%p for k from 1 to 12000 while(ii=0)do:
%p if {k} intersect lst = {}
%p then
%p ii:=1:lst:=lst union {k}:kk:=kk+1:T[kk]:=k:
%p else
%p fi:
%p od:
%p jj:=0:n0:=nops(lst):s:=s:=sum(āT[i]ā,āiā=1..n0):
%p for p from 1 to 12000 while(jj=0) do:
%p z1:=sqrt(5*(s+p)^2+4):z2:=sqrt(5*(s+p)^2-4):
%p if (z1=floor(z1) or z2=floor(z2)) and {p} intersect lst={}
%p then
%p jj:=1:lst:=lst union {p}:kk:=kk+1:T[kk]:=p:
%p else
%p fi:
%p od:
%p od:
%p print(T):
%Y Cf. A000045.
%K nonn
%O 0,3
%A _Michel Lagneau_, Aug 05 2016
|