%I #45 Apr 07 2018 04:47:59
%S -1,0,1,2,3,3,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,6,7,7,7,6,8,8,8,8,8,8,8,
%T 8,8,8,8,8,9,8,9,9,9,9,8,9,9,7,9,7,9,9,8,9,10,10,10,10,10,10,10,9,10,
%U 10,10,9,10,10,10
%N Largest integer k such that n^2 - 3*2^k can be written as x^2 + 2*y^2 with x and y integers, or -1 if no such k exists.
%C Conjecture: a(n) > 0.6*log_2(log_2 n) for all n > 2, and also lim inf_{n->infinity} a(n)/(log n) = 0.
%C The author's Square Conjecture in A301471 would imply that a(n) >= 0 for all n > 1. We have verified that a(n) > 0.6*log_2(log_2 n) for all n = 3..4*10^9. For n = 2857932461, we have a(n) = 3 and 0.603 < a(n)/log_2(log_2 n) < 0.604.
%C It is known that a positive integer n has the form x^2 + 2*y^2 with x and y integers if and only if the p-adic order of n is even for any prime p == 5 or 7 (mod 8).
%H Zhi-Wei Sun, <a href="/A301640/b301640.txt">Table of n, a(n) for n = 1..10000</a>
%H Zhi-Wei Sun, <a href="http://dx.doi.org/10.1016/j.jnt.2016.11.008">Refining Lagrange's four-square theorem</a>, J. Number Theory 175(2017), 167-190.
%H Zhi-Wei Sun, <a href="http://arxiv.org/abs/1701.05868">Restricted sums of four squares</a>, arXiv:1701.05868 [math.NT], 2017-2018.
%e a(2) = 0 since 2^2 - 3*2^0 = 1^2 + 2*0^2.
%e a(3) = 1 since 3^2 - 3*2^1 = 2^2 + 2*1^2.
%e a(5) = 3 since 5^2 - 3*2^3 = 1^2 + 2*0^2.
%e a(6434567) = 10 since 6434567^2 - 3*2^10 = 5921293^2 + 2*1780722^2.
%p f:= proc(n) local k,t;
%p for k from floor(log[2](n^2/3)) by -1 to 0 do
%p if g(n^2 - 3*2^k) then return k fi
%p od;
%p -1
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Mar 26 2018
%t f[n_]:=f[n]=FactorInteger[n];
%t g[n_]:=g[n]=Sum[Boole[(Mod[Part[Part[f[n],i],1],8]==5||Mod[Part[Part[f[n],i],1],8]==7)&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
%t QQ[n_]:=QQ[n]=(n==0)||(n>0&&g[n]);
%t tab={};Do[Do[If[QQ[n^2-3*2^(Floor[Log[2,n^2/3]]-k)],tab=Append[tab,Floor[Log[2,n^2/3]]-k];Goto[aa]],{k,0,Log[2,n^2/3]}];tab=Append[tab,-1];Label[aa],{n,1,70}];Print[tab]
%Y Cf. A000079, A000290, A002479, A299924, A299537, A299794, A300219, A300362, A300396, A300510, A301376, A301391, A301452, A301471, A301472, A301479, A301579.
%K sign
%O 1,4
%A _Zhi-Wei Sun_, Mar 25 2018