We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged


C++ (g++), 60 54 bytes 1-indexed. f(2)==29. int f(int n){return((n>>3|n>>2|n)&1)+((n^n>>3)&1)+29;} Solution from k-map, which simplified to A=w+x+z and B=zw'+z'w. int f(int n){ //N is a 4-digit binary number wxyz. return((n>>3 | n>>2 | n) & 1) //Add 1 if (w OR x OR z) +((n ^ n>>3) & ...


z80 Machine Code, 13 bytes 47 1F 1F 1F A8 E6 01 05 10 01 3D C6 30 Takes input (starting at 1) in the A register and stores output in the same register. This was manually assembled from the ez80 manual and is not yet tested, therefore it might contain some mistakes. Explanation: 47 ld b, a ; Copy the value to the B register 1F 1F 1F rra (...

Only top voted, non community-wiki answers of a minimum length are eligible