login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Smallest square that begins with n (in binary).
3

%I #16 May 23 2016 08:06:11

%S 0,1,4,25,4,81,25,121,16,9,81,361,25,441,225,121,16,1089,36,625,81,

%T 169,361,1521,49,25,841,441,225,3721,121,2025,64,529,1089,4489,36,

%U 2401,1225,625,81,5329,169,2809,11449,361,5929,1521,6241,49,100,6561,841,6889

%N Smallest square that begins with n (in binary).

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

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

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

%o (Python)

%o from gmpy2 import isqrt

%o def A272680(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(x)

%o d *= 2

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

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

%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