1) Is this a binary counter? So what does the counter do when it reaches 23, stop or reset to zero? Either way you could use a 5-bit binary counter and an AND gate on the outputs to detect when the count of 23 (10111) is reached and then either stop or reset the counter.
2) For that I would write the binary code for the sequence you want and compare that to the binary code output of a 3-bit binary counter counting from zero to 7. From this determine the logic required to generate the required sequence from the binary output. You would likely want to then minimize the required logic with a Karnaugh map or some such procedure..