login
A279430
Numbers k such that k^2 has an odd number of digits in base 2 and the middle digit is 0.
15
0, 2, 4, 5, 8, 9, 10, 16, 17, 18, 19, 22, 32, 33, 34, 35, 36, 37, 40, 41, 44, 64, 65, 66, 67, 68, 69, 70, 71, 76, 77, 80, 81, 84, 85, 87, 90, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 144, 145, 146, 147, 151, 152, 153, 156, 157, 160, 161, 164
OFFSET
1,2
LINKS
Andrew Weimholt, Middle digit in square numbers, Seqfan Mailing list, Dec 12 2016.
MATHEMATICA
a[n_]:=Part[IntegerDigits[n, 2], (Length[IntegerDigits[n, 2]]+1)/2];
Select[Range[0, 164], OddQ[Length[IntegerDigits[#^2, 2]]] && a[#^2]==0 &] (* Indranil Ghosh, Mar 06 2017 *)
k2oQ[n_]:=Module[{idn=IntegerDigits[n^2, 2], len}, len=Length[idn]; OddQ[ len] && idn[[(len+1)/2]]==0]; Select[Range[0, 200], k2oQ] (* Harvey P. Dale, Jan 29 2020 *)
PROG
(PARI) isok(k) = my(d=digits(k^2, 2)); (#d%2 == 1) && (d[#d\2 +1] == 0);
for(k=0, 164, if(k==0 || isok(k)==1, print1(k, ", "))); \\ Indranil Ghosh, Mar 06 2017
(Python)
i=0
j=1
while i<=164:
n=str(bin(i**2)[2:])
l=len(n)
if l%2 and n[(l-1)//2]=="0":
print(str(i), end=", ")
j+=1
i+=1 # Indranil Ghosh, Mar 06 2017
CROSSREFS
Cf. A279431.
See A279420-A279429 for a base-10 version.
Sequence in context: A339906 A375906 A359267 * A003714 A340956 A010402
KEYWORD
nonn,base,easy
AUTHOR
Lars Blomberg, Jan 07 2017
STATUS
approved