login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A169810 a(n) = n XOR n^2. 13
0, 0, 6, 10, 20, 28, 34, 54, 72, 88, 110, 114, 156, 164, 202, 238, 272, 304, 342, 378, 388, 428, 498, 518, 600, 616, 702, 706, 780, 852, 922, 990, 1056, 1120, 1190, 1258, 1332, 1404, 1410, 1494, 1640, 1720, 1742, 1810, 1980, 1988, 2154, 2190, 2352, 2384, 2550, 2586 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

XOR the binary representations of n and n^2.

LINKS

N. J. A. Sloane, Table of n, a(n) for n = 0..10000

EXAMPLE

a(5) = 28:

..101 <- 5

11001 <- 25

----- <- XOR

11100 -> 28

MAPLE

f:=proc(n) local i, t0, t1, t2, ts, tl, n1, n2;

t1:=convert(n, base, 2); t2:=convert(n^2, base, 2); n1:=nops(t1); n2:=nops(t2);

if n1 < n2 then ts:= t1; tl:=t2; else ts:=t2; tl:=t1; fi;

t0:=[]; for i from 1 to nops(ts) do t0:=[op(t0), (ts[i] + tl[i]) mod 2 ]; od:

for i from nops(ts)+1 to nops(tl) do t0:=[op(t0), tl[i]]; od:

add(2^(i-1)*t0[i], i=1..nops(t0)); end;

# second Maple program:

a:= n-> Bits[Xor](n, n^2):

seq(a(n), n=0..100);  # Alois P. Heinz, Mar 29 2018

MATHEMATICA

a[n_]:=BitXor[n, n^2]; Array[a, 60, 0] (* Robert G. Wilson v, Jun 09 2010 *)

PROG

(Haskell)

import Data.Bits (xor)

a169810 n = n ^ 2 `xor` n :: Integer

-- Reinhard Zumkeller, Dec 27 2012

CROSSREFS

Suggested by A174375. Cf. A070883, A169811-A169814.

Cf. A007745 (OR), A213541 (AND), A002378.

Sequence in context: A068017 A270544 A181995 * A095146 A163172 A117348

Adjacent sequences:  A169807 A169808 A169809 * A169811 A169812 A169813

KEYWORD

nonn

AUTHOR

N. J. A. Sloane, May 28 2010

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 12:04 EDT 2019. Contains 322456 sequences. (Running on oeis4.)