login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A298816 a(n) is the binary XOR of all n-bit squares, with a(2)=0 indicating that no 2-bit squares exist. 2

%I #8 Jan 04 2019 18:45:27

%S 1,0,4,9,9,21,12,28,449,577,357,997,6085,14533,12517,15077,121125,

%T 152869,400028,1041052,1290704,2556368,4913664,11950592,22421376,

%U 63692672,7674753,78355329,312723717,656197893,1089399836,2723474460,4196236289,2416016385,8186515468

%N a(n) is the binary XOR of all n-bit squares, with a(2)=0 indicating that no 2-bit squares exist.

%C XOR is the binary exclusive-or operator.

%e There are two squares whose binary representation is 5 bits long, namely 16 and 25. a(5) = 9 because 25 XOR 16 = 9.

%e There are four squares whose binary representation is 7 bits long, namely 64, 81, 100 and 121. a(7) = (64 XOR 81 XOR 100 XOR 121) = 12.

%o (Python)

%o i = n = x = L = 1

%o while L < 47:

%o i+=1

%o nextn = i*i

%o if (nextn ^ n) > n: # if lengths of binary representations are different

%o print str(x)+',',

%o x = 0

%o prevL = L

%o L = len(bin(nextn))-2

%o for j in range(prevL, L-1): print '0,',

%o n = nextn

%o x ^= n

%Y Cf. A000290, A007088, A070939.

%K nonn,base

%O 1,3

%A _Alex Ratushnyak_, Jan 26 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)