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!)
A334042 Write n^2 in binary, interchange 0's and 1's, convert back to decimal. 1
1, 0, 3, 6, 15, 6, 27, 14, 63, 46, 27, 6, 111, 86, 59, 30, 255, 222, 187, 150, 111, 70, 27, 494, 447, 398, 347, 294, 239, 182, 123, 62, 1023, 958, 891, 822, 751, 678, 603, 526, 447, 366, 283, 198, 111, 22, 1979, 1886, 1791, 1694, 1595, 1494, 1391, 1286, 1179 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
FORMULA
a(n) = A035327(A000290(n)). - Alois P. Heinz, Apr 13 2020
MAPLE
a:= n-> (l-> add((1-l[i])*2^(i-1), i=1..nops(l)))(convert(n, base, 2)):
seq(a(n), n=0..60); # Alois P. Heinz, Apr 13 2020
MATHEMATICA
a[n_] := FromDigits[1 - IntegerDigits[n^2, 2], 2]; Array[a, 55, 0] (* Amiram Eldar, Apr 13 2020 *)
PROG
(Python)
def oppsquare(n):
s = str(bin(n**2))[2:]
t = ''
for i in range(len(s)):
if s[i] == '0':
t += '1'
else:
t += '0'
return int(t, 2)
(PARI) a(n)=if(n, my(s=n^2); bitneg(s, exponent(s)+1), 1) \\ Charles R Greathouse IV, Apr 13 2020
(Python)
def A334042(n):
return 2**(len(bin(n**2))-2)-1-n**2 # Chai Wah Wu, Apr 13 2020
CROSSREFS
Sequence in context: A058141 A144654 A132279 * A066107 A162276 A261955
KEYWORD
nonn,base,easy
AUTHOR
Christoph Schreier, Apr 13 2020
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 23 08:33 EDT 2024. Contains 371905 sequences. (Running on oeis4.)