Question Author
I will tell you where I am at (Alan Sugar impersonation LOL) On the verge of giving Hymie BA I was then torn because another answer had been found. Therefore I asked for methods in finding both answers. Note I am still dubious about the 2016 answer on the basis could a child be so precocious??
Clare and Zebu duly obliged with accurate step by step guidance leading to the answers 1998 and 2016. I will say further, I am persuaded by the odd/even number approach.
TTT, firstly thank you for your contribution. Unfortunately the pseudocode appears to contain some ambiguity. It steers me away from the answer.
Please understand this. Approx 25 years ago I constructed my own lean-to conservatory. Dug out a shallow trench, bought cement mixer (very nearly got back what I paid for it :-) Laid down the footings and concrete floor base. Put down the second course of blue bricks. On occasion my wife assisted with the build and builder friend helped with laying first course of blue brick and attaching the roof. My point is, I had made all sorts of notes reminding me to do A before B before C etc. At least half of them would have made no sense to anyone else but they enabled me to erect successfully a fully completed conservatory which still stands today :-)
Had I been trying to instruct people on an open forum, I would have taken far more care in writing out instructions on how to erect a conservatory. Similarly (going back now far more years than I care to remember) when programming in machine code (8 bit motorola processor, so you'll appreciate with your binary knowkedge, 8 bits gives a limited instruction set) we were always encouraged to write mneumonics. Again these were personal hints in helping us to write our own unique programs. Your pseudocode has helped you successfully construct a program in finding not one but two answers to this question. Sadly it does not help me on seeing how you arrived at the answers, it is too much a generalisation. After all, things will become pretty tedious on problem solving threads if everyone claims to have solved the question using a computer without demonstrating how the program works or presenting their code.
I am a fair chap though, I will immediately set up another thread giving you the opportunity to show/run your computer program or present your code which can then be (copy and pasted) into an on line compiler, executed and its functionality verified. Then BA will be rightfully yours :-)