%I #10 May 11 2015 15:48:03
%S 1,2,3,6,4,11,8,5,26,9,12,7,15,17,33,43,10,25,16,19,13,32,39,21,61,
%T 175,22,20,57,37,95,14,18,50,27,40,34,110,29,24,171,23,64,28,46,203,
%U 45,31,137,91,134,35,58,30,90,54,69,106,38,73,360,296,67,88,48,70,526,109,124
%N Position of n in A105822.
%C Is A105822 a permutation of the positive integers?
%H Ivan Neretin, <a href="/A104663/b104663.txt">Table of n, a(n) for n = 1..1000</a>
%p N:= 1000: # to go up to the first entry missing in A105822(1 .. N)
%p A:= 'A':
%p a[1]:= 1: a[2]:= 2:
%p A[1]:= 1: A[2]:= 2:
%p for n from 3 to N do
%p ds:= map(t -> rhs(op(t)), [msolve(x^2=a[n-1]^2, 4*a[n-2])]);
%p xmin:= infinity;
%p for d in ds do
%p found:= false;
%p for y from floor((a[n-1]-d)/(4*a[n-2]))+1 do
%p xy:= 4*a[n-2]*y + d;
%p cand:= (xy^2 - a[n-1]^2)/(4*a[n-2]);
%p if cand >= xmin then found:= false; break fi;
%p if not assigned(A[cand]) then found:= true; break fi;
%p od:
%p if found then xmin:= cand; fi;
%p od:
%p a[n]:= xmin;
%p A[xmin]:= n;
%p od:
%p M:= min(select(t -> not assigned(A[t]), [$1..N+1])):
%p seq(A[i],i=1..M-1); # _Robert Israel_, May 11 2015
%Y Cf. A105822.
%K nonn
%O 1,2
%A _Zak Seidov_, Apr 22 2005
%E Definition corrected by _N. J. A. Sloane_, Aug 29 2008
|