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.

A145768 a(n) = the bitwise XOR of squares of first n natural numbers.

This page as a plain text file.
%I A145768 #54 Apr 08 2025 18:27:11
%S A145768 0,1,5,12,28,5,33,16,80,1,101,28,140,37,225,0,256,33,357,12,412,37,
%T A145768 449,976,400,993,325,924,140,965,65,896,1920,961,1861,908,1692,965,
%U A145768 1633,912,1488,833,1445,668,1292,741,2721,512,2816,609,2981,396,2844,485
%N A145768 a(n) = the bitwise XOR of squares of first n natural numbers.
%C A145768 Up to n=10^8, a(15) is the only zero term and a(1)=a(9) are the only terms for which a(n)=1. Can it be proved that any number can only appear a finite number of times in this sequence? [_M. F. Hasler_, Oct 20 2008]
%C A145768 Even terms occur at A014601, odd terms at A042963; A010873(a(n))=A021913(n+1). - _Reinhard Zumkeller_, Jun 05 2012
%C A145768 If squares occur, they must be at indexes != 2 or 5 (mod 8). - _Roderick MacPhee_, Jul 17 2017
%H A145768 Reinhard Zumkeller, <a href="/A145768/b145768.txt">Table of n, a(n) for n = 0..10000</a>
%H A145768 StackExchange, <a href="https://math.stackexchange.com/questions/2361525/perfect-squares-in-a-xor-sum-of-perfect-squares#2361525">Perfect squares in a XOR-Sum of perfect squares</a>
%F A145768 a(n)=1^2 xor 2^2 xor ... xor n^2.
%p A145768 A[0]:= 0:
%p A145768 for n from 1 to 100 do A[n]:= Bits:-Xor(A[n-1],n^2) od:
%p A145768 seq(A[i],i=0..100); # _Robert Israel_, Dec 08 2019
%t A145768 Rest@ FoldList[BitXor, 0, Array[#^2 &, 50]]
%o A145768 (PARI) an=0; for( i=1,50, print1(an=bitxor(an,i^2),",")) \\ _M. F. Hasler_, Oct 20 2008
%o A145768 (PARI) al(n)=local(m);vector(n,k,m=bitxor(m,k^2))
%o A145768 (Haskell)
%o A145768 import Data.Bits (xor)
%o A145768 a145768 n = a145768_list !! n
%o A145768 a145768_list = scanl1 xor a000290_list  -- _Reinhard Zumkeller_, Jun 05 2012
%o A145768 (Python)
%o A145768 from functools import reduce
%o A145768 from operator import xor
%o A145768 def A145768(n):
%o A145768     return reduce(xor, [x**2 for x in range(n+1)]) # _Chai Wah Wu_, Aug 08 2014
%Y A145768 Cf. A003815, A145827, A145828, A145829, A145830, A145831. [_M. F. Hasler_, Oct 20 2008]
%Y A145768 Cf. A193232.
%Y A145768 Cf. A000290.
%K A145768 easy,nonn,base,look
%O A145768 0,3
%A A145768 _Vladimir Reshetnikov_, Oct 18 2008