cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A279431 Numbers k such that k^2 has an odd number of digits in base 2 and the middle digit is 1.

This page as a plain text file.
%I A279431 #19 Dec 23 2024 14:53:45
%S A279431 1,11,20,21,38,39,42,43,45,72,73,74,75,78,79,82,83,86,88,89,140,141,
%T A279431 142,143,148,149,150,154,155,158,159,162,163,166,167,169,170,172,173,
%U A279431 175,178,180,181,272,273,274,275,276,277,278,284,285,286,287,292,293
%N A279431 Numbers k such that k^2 has an odd number of digits in base 2 and the middle digit is 1.
%H A279431 Lars Blomberg, <a href="/A279431/b279431.txt">Table of n, a(n) for n = 1..10000</a>
%H A279431 Andrew Weimholt, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2016-December/017140.html">Middle digit in square numbers</a>, Seqfan Mailing list, Dec 12 2016.
%e A279431 1^2 = (1), 72^2 = 101000(1)000000, 158^2 = 1100001(1)0000100
%t A279431 a[n_]:=Part[IntegerDigits[n, 2], (Length[IntegerDigits[n, 2]] + 1)/2];
%t A279431 Select[Range[0, 293], OddQ[Length[IntegerDigits[#^2, 2]]] && a[#^2]==1 &] (* _Indranil Ghosh_, Mar 06 2017 *)
%o A279431 (PARI)
%o A279431 isok(k) = my(d=digits(k^2, 2)); (#d%2 == 1) && (d[#d\2 +1] == 1);
%o A279431 for(k=0, 293, if(isok(k)==1, print1(k,", "))); \\ _Indranil Ghosh_, Mar 06 2017
%o A279431 (Python)
%o A279431 i=0
%o A279431 j=1
%o A279431 while i<=293:
%o A279431     n=str(bin(i**2)[2:])
%o A279431     l=len(n)
%o A279431     if l%2 and n[(l-1)//2]=="1":
%o A279431         print(str(i), end=",")
%o A279431         j+=1
%o A279431     i+=1 # _Indranil Ghosh_, Mar 06 2017
%Y A279431 Cf. A279430.
%Y A279431 See A279420-A279429 for a base 10 version.
%K A279431 nonn,base,easy
%O A279431 1,2
%A A279431 _Lars Blomberg_, Jan 07 2017