login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A330270 a(n) is the least nonnegative integer k such that n XOR k is a square (where XOR denotes the bitwise XOR operator). 4
0, 0, 2, 2, 0, 1, 2, 3, 1, 0, 3, 2, 5, 4, 7, 6, 0, 1, 2, 3, 4, 5, 6, 7, 1, 0, 3, 2, 5, 4, 7, 6, 4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11, 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

This sequence has similarities with A329794 as the XOR operator and the "box" operator defined in A329794 both map (n, n) to 0 for any n (however here we accept 0 as a square).

LINKS

Rémy Sigrist, Table of n, a(n) for n = 0..8192

Rémy Sigrist, Scatterplot of the ordinal transform of the first 2^20 terms

Rémy Sigrist, Scatterplot of (x, y) such that x XOR y is a square, 0 <= x, y <= 1023

FORMULA

a(n) = 0 iff n is a square.

a(a(n)) <= n.

EXAMPLE

For n = 7,

- 7 XOR 0 = 7 (not a square),

- 7 XOR 1 = 6 (not a square),

- 7 XOR 2 = 5 (not a square),

- 7 XOR 3 = 4 = 2^2,

- hence a(7) = 3.

PROG

(PARI) a(n) = for (k=0, oo, if (issquare(bitxor(n, k)), return (k)))

CROSSREFS

See A330271 for the cube variant.

Cf. A000290, A003987, A295520, A329794.

Sequence in context: A101565 A292944 A327188 * A029341 A240181 A079070

Adjacent sequences:  A330267 A330268 A330269 * A330271 A330272 A330273

KEYWORD

nonn,base,easy

AUTHOR

Rémy Sigrist, Dec 08 2019

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 October 19 09:22 EDT 2021. Contains 348074 sequences. (Running on oeis4.)