JS-Forth, 32 bytes
Not super short, but it's shorter than Java. This function pushes the result onto the stack. This requires JS-Forth because I use <<.
: f dup dup * 1- over 1- << 1+ ;
mbomb007
- 23.6k
- 7
- 66
- 143
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeNot super short, but it's shorter than Java. This function pushes the result onto the stack. This requires JS-Forth because I use <<.
: f dup dup * 1- over 1- << 1+ ;