login
Smallest binary square that begins with the binary expansion of n.
3

%I #19 May 23 2016 08:06:41

%S 0,1,100,11001,100,1010001,11001,1111001,10000,1001,1010001,101101001,

%T 11001,110111001,11100001,1111001,10000,10001000001,100100,1001110001,

%U 1010001,10101001,101101001,10111110001,110001,11001,1101001001,110111001,11100001,111010001001

%N Smallest binary square that begins with the binary expansion of n.

%D Allan C. Wechsler, posting to math-fun mailing list May 22 2016.

%H Chai Wah Wu, <a href="/A272681/b272681.txt">Table of n, a(n) for n = 0..10000</a>

%e a(10)=1010001 = 81_10, because 1010001_2 begins with 1010 = 10_2.

%o (Python)

%o from gmpy2 import isqrt

%o def A272681(n):

%o if n == 0:

%o return 0

%o else:

%o d, nd = 1, n

%o while True:

%o x = (isqrt(nd-1)+1)**2

%o if x < nd+d:

%o return int(bin(x)[2:])

%o d *= 2

%o nd *= 2 # _Chai Wah Wu_, May 22 2016

%Y Cf. A007088, A018851, A018796, A272679, A272680.

%K nonn,base,easy

%O 0,3

%A _N. J. A. Sloane_, May 22 2016

%E More terms from _Chai Wah Wu_, May 22 2016