A345257 Tiefenbruck sequence for the game of countably infinitely many hats.
-1, 1, 0, 0, 2, 1, 2, -1, 4, 1, 0, 0, 2, 1, 2, 4, 3, 1, 0, 0, 2, 1, 2, 3, 3, 1, 0, 0, 2, 1, 2, 3, 5, 1, 0, 0, 2, 1, 2, 5, 4, 1, 0, 0, 2, 1, 2, 4, 5, 1, 0, 0, 2, 1, 2, 5, -1, 1, 0, 0, 2, 1, 2, -1, 7, 1, 0, 0, 2, 1, 2, 7, 4, 1, 0, 0, 2, 1, 2, 4, 3, 1, 0, 0, 2, 1
Offset: 0
Keywords
Examples
With n = 06567700 (octal notation), we have a(n) = 3 + 3 + 3 + 3 + 2 = 14.
Links
- Joe Buhler, Hat Problems, Numberphile Video.
- Frederic Ruget, Towers of hats.
- Frederic Ruget, Hats Calculator.
- Frederic Ruget, Infinitely Many Hats.
- Stan Wagon, An Infinitely Puzzling Hat Problem.
Programs
-
JavaScript
// Tiefenbruck sequence for the game of countably infinitely many hats function a(n) { let offset = 0; while (true) { if (n == 0) return -1; switch(n & 7) { case 1: return offset + 1; case 2: return offset + 0; case 3: return offset + 0; case 4: return offset + 2; case 5: return offset + 1; case 6: return offset + 2; } n >>= 3; offset += 3; } }
Formula
[a(n): 0 <= n < 7] = [-1, 1, 0, 0, 2, 1, 2]
For n > 7:
if (n mod 8) in {1, 2, 3, 4, 5, 6}, then a(n) = a(n mod 8);
otherwise if a(floor(n/8)) = -1, then a(n) = -1;
otherwise a(n) = a(floor(n/8)) + 3.
Comments