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.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Thanks to @Mr. Xcoder for saving a bytethree bytes!
f(n){for(n=-1;++n<18;)printf("%d\n",((1<<n)-n)<<(n>0)!!n);puts("NOPE!");}
Try it online!Try it online!
Thanks to @Mr. Xcoder for saving a byte!
f(n){for(n=-1;++n<18;)printf("%d\n",((1<<n)-n)<<(n>0));puts("NOPE!");}
Try it online!
Thanks to @Mr. Xcoder for saving three bytes!
f(n){for(n=-1;++n<18;)printf("%d\n",((1<<n)-n)<<!!n);puts("NOPE!");}
f(n){for(n=-1;++n<18;)printf("%d\n",((1<<n)-n)*2-<<(n<1n>0));puts("NOPE!");}
f(n){for(n=-1;++n<18;)printf("%d\n",((1<<n)-n)*2-(n<1));puts("NOPE!");}