login
Least nonnegative 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.
6

%I #13 Mar 27 2018 09:32:59

%S -1,0,0,2,0,0,1,4,1,0,0,2,0,0,1,6,1,0,0,2,0,2,1,4,1,0,0,2,0,3,3,8,1,0,

%T 3,2,0,0,3,4,1,0,1,4,0,0,1,6,3,0,0,2,1,0,1,4,3,0,1,5,0,5,1,10,1,0,0,2,

%U 3,0,4,4,1,2,0,2,0,0,3,6

%N Least nonnegative 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 The Square Conjecture in A301471 implies that a(n) >= 0 for all n > 1.

%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).

%C Numbers t such that a(t) = 0 are 2, 3, 5, 6, 10, 11, 13, 14, 18, 19, 21, 26, 27, 29, 34, 37, ... - _Altug Alkan_, Mar 26 2018

%H Zhi-Wei Sun, <a href="/A301579/b301579.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(1) = -1 since 1^2 - 3*2^k < 0 for all k = 0,1,2,....

%e a(31) = 3 since 31^2 - 3*2^3 = 17^2 + 2*18^2.

%e a(2^k) = 2*k - 2 for all k = 1,2,3,..., because (2^k)^2 - 3*2^(2*k-2) = (2^(k-1))^2 + 2*0^2, and (2^k)^2 - 3*2^j = 2^j*(2^(2*k-j) - 3) with 0 <= j < 2*k-2 cannot be written as x^2 + 2*y^2 with x and y integers.

%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^k],tab=Append[tab,k];Goto[aa]],{k,0,Log[2,n^2/3]}];tab=Append[tab,-1];Label[aa],{n,1,80}];Print[tab]

%Y Cf. A000079, A000290, A002479, A299924, A299537, A299794, A300219, A300362, A300396, A300510, A301376, A301391, A301452, A301471, A301472, A301479.

%K sign

%O 1,4

%A _Zhi-Wei Sun_, Mar 23 2018