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!)
A145768 a(n) = the bitwise XOR of squares of first n natural numbers. 10
0, 1, 5, 12, 28, 5, 33, 16, 80, 1, 101, 28, 140, 37, 225, 0, 256, 33, 357, 12, 412, 37, 449, 976, 400, 993, 325, 924, 140, 965, 65, 896, 1920, 961, 1861, 908, 1692, 965, 1633, 912, 1488, 833, 1445, 668, 1292, 741, 2721, 512, 2816, 609, 2981, 396, 2844, 485 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
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]
Even terms occur at A014601, odd terms at A042963; A010873(a(n))=A021913(n+1). - Reinhard Zumkeller, Jun 05 2012
If squares occur, they must be at indexes != 2 or 5 (mod 8). - Roderick MacPhee, Jul 17 2017
LINKS
FORMULA
a(n)=1^2 xor 2^2 xor ... xor n^2.
MAPLE
A[0]:= 0:
for n from 1 to 100 do A[n]:= Bits:-Xor(A[n-1], n^2) od:
seq(A[i], i=0..100); # Robert Israel, Dec 08 2019
MATHEMATICA
Rest@ FoldList[BitXor, 0, Array[#^2 &, 50]]
PROG
(PARI) an=0; for( i=1, 50, print1(an=bitxor(an, i^2), ", ")) \\ M. F. Hasler, Oct 20 2008
(PARI) al(n)=local(m); vector(n, k, m=bitxor(m, k^2))
(Haskell)
import Data.Bits (xor)
a145768 n = a145768_list !! n
a145768_list = scanl1 xor a000290_list -- Reinhard Zumkeller, Jun 05 2012
(Python)
from operator import xor
def A145768(n):
....return reduce(xor, [x**2 for x in range(n+1)]) # Chai Wah Wu, Aug 08 2014
CROSSREFS
Cf. A193232.
Cf. A000290.
Sequence in context: A128439 A240187 A172426 * A162778 A160807 A038376
KEYWORD
easy,nonn,base,look
AUTHOR
STATUS
approved

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 19 03:14 EDT 2024. Contains 371782 sequences. (Running on oeis4.)