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.
%I A331961 #14 Aug 22 2023 14:14:40 %S A331961 0,1,0,1,4,4,4,4,0,9,0,9,4,9,4,9,16,16,16,16,16,16,16,16,16,25,16,25, %T A331961 16,25,16,25,0,1,0,1,36,36,36,36,0,9,0,9,36,36,36,36,16,49,16,49,36, %U A331961 49,36,49,16,49,16,49,36,49,36,49,64,64,64,64,64,64,64 %N A331961 a(n) is the greatest square number k such that n AND k = k (where AND denotes the bitwise AND operator). %H A331961 Rémy Sigrist, <a href="/A331961/b331961.txt">Table of n, a(n) for n = 0..8192</a> %F A331961 a(n) = 0 iff n belongs to A062880. %F A331961 a(n^2) = n^2. %e A331961 The first terms, alongside the binary representations of n and of a(n), are: %e A331961 n a(n) bin(n) bin(a(n)) %e A331961 -- ---- ------ --------- %e A331961 0 0 0 0 %e A331961 1 1 1 1 %e A331961 2 0 10 0 %e A331961 3 1 11 1 %e A331961 4 4 100 100 %e A331961 5 4 101 100 %e A331961 6 4 110 100 %e A331961 7 4 111 100 %e A331961 8 0 1000 0 %e A331961 9 9 1001 1001 %e A331961 10 0 1010 0 %e A331961 11 9 1011 1001 %e A331961 12 4 1100 100 %e A331961 13 9 1101 1001 %e A331961 14 4 1110 100 %e A331961 15 9 1111 1001 %e A331961 16 16 10000 10000 %o A331961 (PARI) a(n) = forstep (m=sqrtint(n), 0, -1, if (bitand(n, m^2)==m^2, return (m^2))) %o A331961 (Python) %o A331961 from math import isqrt %o A331961 def A331961(n): return next(m for m in (k**2 for k in range(isqrt(n),-1,-1)) if n&m==m) # _Chai Wah Wu_, Aug 22 2023 %Y A331961 Cf. A062880, A330270. %K A331961 nonn,base %O A331961 0,5 %A A331961 _Rémy Sigrist_, Feb 02 2020