OFFSET
0,3
LINKS
Daniel Starodubtsev, Table of n, a(n) for n = 0..10000
FORMULA
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
KEYWORD
nonn,base,easy
AUTHOR
Christoph Schreier, Apr 13 2020
STATUS
approved