OFFSET
1,4
COMMENTS
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.
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.
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).
LINKS
Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
Zhi-Wei Sun, Refining Lagrange's four-square theorem, J. Number Theory 175(2017), 167-190.
Zhi-Wei Sun, Restricted sums of four squares, arXiv:1701.05868 [math.NT], 2017-2018.
EXAMPLE
a(2) = 0 since 2^2 - 3*2^0 = 1^2 + 2*0^2.
a(3) = 1 since 3^2 - 3*2^1 = 2^2 + 2*1^2.
a(5) = 3 since 5^2 - 3*2^3 = 1^2 + 2*0^2.
a(6434567) = 10 since 6434567^2 - 3*2^10 = 5921293^2 + 2*1780722^2.
MAPLE
f:= proc(n) local k, t;
for k from floor(log[2](n^2/3)) by -1 to 0 do
if g(n^2 - 3*2^k) then return k fi
od;
-1
end proc:
map(f, [$1..100]); # Robert Israel, Mar 26 2018
MATHEMATICA
f[n_]:=f[n]=FactorInteger[n];
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;
QQ[n_]:=QQ[n]=(n==0)||(n>0&&g[n]);
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]
CROSSREFS
KEYWORD
sign
AUTHOR
Zhi-Wei Sun, Mar 25 2018
STATUS
approved