Donate SIGN UP

Birthday By Numbers

Avatar Image
kuiperbelt | 14:23 Tue 04th Jul 2023 | Science
29 Answers
Should I live long enough to see it, on my birthday in the year 2025, my age will be equal to the sum of the digits of my birth year. I will still be less than 100 years old. What is my birth year and how old will I be in 2025?

Gravatar

Answers

21 to 29 of 29rss feed

First Previous 1 2

Avatar Image
// Still, I bet the program TTT wrote was faster :) // Albeit pseudocode, one could be forgiven interpreting I = 1925 as a declared variable and a constant. This leads to the statement... // if (2025 - I) = dtot // corresponding to... 'if 100 = dtot'. Clearly no 4 digits arranged in any permutation will sum to 100. Plainly, Clare concedes her work to the brevity of...
20:07 Thu 06th Jul 2023
I certainly wasn't writing my answer with the intention to steal TTT's rightful BA. For my part I consider his pseudocode to be clear. Stopping at 1925 presumably is just because there's no point in checking three-digit ages, although since the maximum age=digit sum constraint is 36 =9+9+9+9, then you could as well run the loop only as far as 2025-36 = 1989.

Funnily enough, though, by that approach, you could then refine the maximum possible age to 28 = 1+9+9+9, meaning you only have to check as far back as 1997, which is one year off anyway, and means that you just have to subtract one from the age and add one to the birth year and you're done for that first solution.

Realising that there's a second solution in the mid-2010s is the tricky bit, and TTT found it first.
CTG: "I certainly wasn't writing my answer with the intention to steal TTT's rightful BA. For my part I consider his pseudocode to be clear. " - thanks I don't see how anyone could mistake the meaning.
"Stopping at 1925 presumably is just because there's no point in checking three-digit ages" - yes the question said he'd be less than 100.
//Stopping at 1925 presumably is just because there's no point in checking three-digit ages//

In the question: I will still be less than 100 years old.
A fair point, although as I say the maximum is 36 anyhow, which makes you wonder why the question-writer thought it necessary to mention.
dunno but Kuiper seems to have disappeared anyway!
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 :-)
you cannot be serious? Giving my BA to Zebu!
"TTT, firstly thank you for your contribution. Unfortunately the pseudocode appears to contain some ambiguity. It steers me away from the answer. " - how?
Ok here's a COBOL version the actual code, and the answers it generates:
https://ibb.co/kBJthDB

21 to 29 of 29rss feed

First Previous 1 2

Do you know the answer?

Birthday By Numbers

Answer Question >>