Skip to main content
deleted 28 characters in body
Source Link
alephalpha
  • 51.9k
  • 7
  • 75
  • 197

PARI/GP, 3933 bytes

n->t=0;[t=f(1+t^q--n)^q|q<-2*binary=if(n,(1+f(n\2)];t^q=n%2*2-1)^q) 

Attempt This Online!Attempt This Online!

PARI/GP, 39 bytes

n->t=0;[t=(1+t^q--)^q|q<-2*binary(n)];t 

Attempt This Online!

PARI/GP, 33 bytes

f(n)=if(n,(1+f(n\2)^q=n%2*2-1)^q) 

Attempt This Online!

Source Link
alephalpha
  • 51.9k
  • 7
  • 75
  • 197

PARI/GP, 39 bytes

n->t=0;[t=(1+t^q--)^q|q<-2*binary(n)];t 

Attempt This Online!