# My two button microwave

Long ago, I encountered a microwave with a display in the "HH:MM:SS" format. But instead of a number pad, you entered the desired time through two buttons:

• An "up" button, which shifted the digits to the left. So "00:00:05" became "00:00:50", and "00:00:10" became "00:01:00". Note how this is not quite the same as multiplying by 10.
• A "down" button, which halved the current time, rounding down, except for "00:00:01" which stayed "00:00:01". Example: "00:01:50" became "00:00:55". The halved time is presented in the regular hours, minutes, seconds format.

A few other facts about how this worked has to be noted:

• The timer started at "00:00:01".
• The "up" button had nothing against nonsensical minutes and seconds values. "00:00:17" became "00:01:70", which made the microwave run for 130 seconds.
• If the hour value ever became larger than 23, it wrapped back to "00:00:01".
• When shifting the hours, the 10s place was just thrown away. Which means "21:20:00" became "12:00:00" and not wrapped around to "00:00:01".

(It's no longer around, so if some corner case is missing I would have to try reconstructing it from memory).

What was the shortest time this microwave could not be set to?
And what was the longest time it could be set to?

This should be possible to figure out without computers, since that's what we did, but I'm not going to stop you from having fun the way you prefer.

Test cases:

00:00:02 →d→ 00:00:01  Halving
00:00:03 →d→ 00:00:01  Halving with flooring
00:00:01 →d→ 00:00:01  Flooring exception, should not round down
00:00:01 →u→ 00:00:10  Shifting
00:00:10 →u→ 00:01:00  Shifting applies to digits
00:00:17 →u→ 00:01:70  Seconds and minutes allowed to be greater than 60
00:01:90 →d→ 00:01:15  Halving should format the time correctly
02:40:00 →u→ 00:00:01  Should wrap around if hours greater than 23
20:10:00 →u→ 01:00:00  Leftmost digit is lost on shifting
02:39:00 →u→ 23:90:00  Total time can be greater than 24 hours

• Does the ending line mean [no-computers] was intentionally left out of the tags? Nov 13, 2020 at 22:58
• @bobble I'm not forbidding computers. But if that's a bad idea if I want any chance of having non-computer answers too, I can add it. Nov 13, 2020 at 23:01
• [no-computers] means you designed the puzzle to be solvable without a computer attack, and intend it to be solved that way. It's up to you whether this puzzle merits the tag. Nov 13, 2020 at 23:06
• did you really have a microwave that works like that or did you invent it just for this puzzle? Nov 13, 2020 at 23:09
• @melfnt In truth, this was a device someone specifically built at the lab (not sure if they made it before or after the problem) Nov 13, 2020 at 23:11

This puzzle is a nice variation of the Hailstone Problem. Not quite the same, since every timer value can be increased and decreased. I solved it by C program, not by logic, assuming that "halve the time" does not mean "halve the number".

The least timer value that can't be set was
1384 seconds from 00:23:04

The greatest timer value that can be set is more than one day
88520 seconds from 23:95:20, actually 01:00:35:20

The conditions say the clock is reset when the hour > 23
So it has the allowed "nonsensical minutes and seconds values"

That was after 7267 button presses, here are the first few in the sequence:
U 00:00:10
U 00:01:00
U 00:10:00
U 01:00:00
U 10:00:00
D 05:00:00
D 02:30:00
U 23:00:00
D 11:30:00
U 13:00:00
D 06:30:00
D 03:15:00
D 01:37:30
U 13:73:00
D 06:66:30
D 03:33:15
D 01:46:37
U 14:63:70
D 07:31:65
etc...

The button sequence was:
UUUUUDDUDUDDDUDDDUDDDUDDDUDDDUDDDUDDDUUDUDUDDDUDDDUDDDUDDDUDDDUUUUDDDUUDDDUDDDUDDDUDDDUDDDUUDUDUDUDDDUUUDDDUDDDUDDDUDDDUDDDUDDDUUDUDUDUDUDDDUDDDUDDDUDDDUDDDUDDDUDDDUUUDDDUDDDUDDDUUUUDDDUUDUDDDUDDDUDDDUDDDUDDDUDDDUDDDDUDDUDDDUDDDUDDDUDDDUDDDUDDDUUDUDUDDDDUDUDDDUDDDUDDDUDDDUDDDUDDDUDDDUDDDUDUDDDUDDDUDDDUDDDUDDDUDDDUUUDDDDDDUDUDDUDDDUDDDUDDDUDDDUDDDUDDDUDDDUDUDDDUDDDUDDDUDUDDDUDDDUDDDUDDDUDDDUDDDUUUUDDDDUDDUDUDDDUUUUDDUDDDUDDDUDDDUDDDUDDDUUDUUDDDUDDDDUUDUDDDUDDDUUDDDDUDUDUDDDUDDDUDDDUDDDUDDDUDDDUUDUDDDDDUDUUDDDUDDDUDDDUUDUDDDUDDDUDDDUDDDUDDDUDDDUUDDUDDUDDDUDDDUDDDUDDDUDDDUDDDUDDDUUDUDDDDUUDUDUDDDUUDDDDUDUDDDUDDDUD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DDDUDDUDDUDDDUDDDUDDDUDDDDDDUDDUDDDDDUDDDDUUDDDUDDDDUUDDDDDUDDUDUDDDUDDDDDUDUDDDUDDDDUDDDDDUDDUDUDDDUDUDDDUDDDUDDDDDUDDDDUDDUDDDDDUDUDDUDUDDDDDUDDDDUUDDDUUDDDDUDDDDUDUDDDDDUDUDDDDDUDUDDDDDDDUDDDUDDUUDDDUDDDDUDDDUDDDDDDUUDDDDUDDDUDUDDDUDDDDUDDDDDDDUDDUUDDDUDDDUDDDUDDDUDDDDDDUUDDDUDDDDDDUDUDDDUDDDDUDDDDUDUDDDUDDDUDDUDDDDUDUDDDUDUDDDUDDDDDDUUDDDDDUDUDDDUDDDDUUDDDUDDDDDUDDUDDUDDDDDDDUDDUDUDDDUDDDUDUDDDDUDDDDUDDDUDUDDDUDDDUDUDDDUDUDDUDDDUDDDUDDDUDDDUDDDDUDDDUDUDUDDDDUDUDDDDUDDDDDDDDDUDUDDUUDDDDUDDDDUUDDDU

I think it would be rather hard to work them out by hand.
Here is the (recursive) C code.

#include <stdio.h>
#define DIGITS      6
#define MAXSECS     10000000    // unreasonably large
#define MAXLEVEL    8000        // found earlier, empirically

char seq[MAXLEVEL];
char repeat[MAXSECS];
char found[MAXSECS];
int carryval[DIGITS] = { 0, 10, 6, 10, 6, 10 };
int maxec;

void recur(int level, int *arr)
{
// convert to decimal value
int decim = arr[0];
for(int i = 1; i < DIGITS; i++)
decim = decim * 10 + arr[i];
if(decim >= MAXSECS)
return;         // unlikely precaution
if(repeat[decim])
return;         // is cyclic
repeat[decim] = 1;

// convert to seconds
int timer = (arr[0] * 10 + arr[1]) * 3600
+ (arr[2] * 10 + arr[3]) * 60
+  arr[4] * 10 + arr[5];
if(timer >= MAXSECS)
return;         // unlikely precaution
found[timer] = 1;

// find max possible
if(maxec < timer) {
maxec = timer;
int days = timer / 86400;
timer %= 86400;
int hrs = timer / 3600;
timer %= 3600;
int mins = timer / 60;
int secs = timer % 60;

printf("Max timer = %d seconds from %d%d:%d%d:%d%d, actually %02d:%02d:%02d:%02d, sequence length = %d\n", maxec,
arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],
days, hrs, mins, secs, level);

for(int i = 0; i < level; i++)
printf("%c", seq[i]);
printf("\n\n");
}

int clk[DIGITS];

// up button - shift left
for(int i = 0; i < DIGITS - 1; i++)
clk[i] = arr[i + 1];
clk[DIGITS - 1] = 0;
if(clk[0] * 10 + clk[1] < 24) {     // otherwise repeats from 1 second
seq[level] = 'U';
recur(level + 1, clk);
}

// down button - halve the time
int carry = 0;
for(int i = 0; i < DIGITS; i++) {
clk[i] = (carry * carryval[i] + arr[i]) / 2;
carry = arr[i] & 1;
}
seq[level] = 'D';
recur(level + 1, clk);
}

int main(void)
{
int arr[DIGITS] = { 0, 0, 0, 0, 0, 1 };
recur(0, arr);

// find smallest time not set
for(int i = 1; i < 86400; i++) {
if(found[i] == 0) {