Infinite Motel
Jack Brennen
jb at brennen.net
Wed Aug 31 20:22:23 CEST 2005
I tried to look at extending/analyzing the sequence, but I hit a problem
right away... I come up with a slightly different sequence (which I'm
sure diverges greatly as you continue):
You show:
1,2,13,3,6,26,4,11,408,9,5,24,7,51,22,102,20,49,18,8,205,10,16,...
I show:
1,2,13,3,6,26,4,11,205,9,5,24,7,51,22,102,20,49,18,8,410,10,16,...
^^^ ^^^
Here's my C code, if anyone wants to run it themselves, or look
for errors in my implementation...
#include <stdio.h>
#include <stdlib.h>
#define XLIM 100000
static unsigned rooms[XLIM];
int main(void)
{
unsigned door=1;
unsigned label=1;
unsigned cnt;
unsigned n;
for (;;) {
printf("Room %u gets label %u\n", door, label);
rooms[door] = label;
for (cnt=0, n=door-1; n; n--)
if (rooms[n]==0)
if (++cnt == label)
break;
if (n) {
door = n;
++label;
continue;
}
for (cnt=0, n=door+1; n<XLIM; n++)
if (rooms[n]==0)
if (++cnt == label)
break;
if (n<XLIM) {
door = n;
++label;
continue;
}
break;
}
printf("done\n");
return EXIT_SUCCESS;
}
More information about the SeqFan
mailing list