fork download
  1. import collections
  2.  
  3. # Define the six tables provided in the puzzle
  4. all_tables = [
  5. # Table 1
  6. [
  7. [ 1, 0, 0, 56, 0, 29, 44, 0], [31, 0, 0, 42, 0, 3, 54, 0],
  8. [ 0, 8, 49, 0, 28, 0, 0, 45], [ 0, 26, 47, 0, 6, 0, 0, 51],
  9. [ 0, 37, 20, 0, 57, 0, 0, 16], [ 0, 59, 14, 0, 39, 0, 0, 18],
  10. [36, 0, 0, 21, 0, 64, 9, 0], [62, 0, 0, 11, 0, 34, 23, 0]
  11. ],
  12. # Table 2
  13. [
  14. [49, 15, 0, 0, 20, 46, 0, 0], [ 0, 0, 2, 64, 0, 0, 35, 29],
  15. [ 0, 0, 39, 25, 0, 0, 6, 60], [24, 42, 0, 0, 53, 11, 0, 0],
  16. [45, 19, 0, 0, 16, 50, 0, 0], [ 0, 0, 30, 36, 0, 0, 63, 1],
  17. [ 0, 0, 59, 5, 0, 0, 26, 40], [12, 54, 0, 0, 41, 23, 0, 0]
  18. ],
  19. # Table 3
  20. [
  21. [10, 0, 47, 0, 0, 50, 0, 23], [ 0, 32, 0, 57, 40, 0, 1, 0],
  22. [54, 0, 19, 0, 0, 14, 0, 43], [ 0, 36, 0, 5, 28, 0, 61, 0],
  23. [15, 0, 42, 0, 0, 55, 0, 18], [ 0, 25, 0, 64, 33, 0, 8, 0],
  24. [51, 0, 22, 0, 0, 11, 0, 46], [ 0, 37, 0, 4, 29, 0, 60, 0]
  25. ],
  26. # Table 4
  27. [
  28. [ 1, 32, 0, 0, 0, 0, 49, 48], [56, 41, 0, 0, 0, 0, 8, 25],
  29. [ 0, 0, 4, 29, 52, 45, 0, 0], [ 0, 0, 53, 44, 5, 28, 0, 0],
  30. [16, 17, 0, 0, 0, 0, 64, 33], [57, 40, 0, 0, 0, 0, 9, 24],
  31. [ 0, 0, 13, 20, 61, 36, 0, 0], [ 0, 0, 60, 37, 12, 21, 0, 0]
  32. ],
  33. # Table 5
  34. [
  35. [ 7, 0, 61, 0, 34, 0, 28, 0], [ 0, 1, 0, 59, 0, 40, 0, 30],
  36. [42, 0, 20, 0, 15, 0, 53, 0], [ 0, 48, 0, 22, 0, 9, 0, 51],
  37. [ 0, 25, 0, 35, 0, 64, 0, 6], [31, 0, 37, 0, 58, 0, 4, 0],
  38. [ 0, 56, 0, 14, 0, 17, 0, 43], [50, 0, 12, 0, 23, 0, 45, 0]
  39. ],
  40. # Table 6
  41. [
  42. [16, 0, 0, 37, 20, 0, 0, 57], [51, 0, 0, 26, 47, 0, 0, 6],
  43. [13, 0, 0, 40, 17, 0, 0, 60], [50, 0, 0, 27, 46, 0, 0, 7],
  44. [ 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0],
  45. [ 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0]
  46. ]
  47. ]
  48.  
  49. # Create a Counter object to store frequencies.
  50. # We initialize it with all numbers from 1 to 64 having a count of 0.
  51. frequencies = collections.Counter({number: 0 for number in range(1, 65)})
  52.  
  53. # Flatten the list of tables into a single list of numbers
  54. all_numbers = [number for table in all_tables for row in table for number in row]
  55.  
  56. # Update the counter with the numbers from the tables (zeros are ignored).
  57. frequencies.update(num for num in all_numbers if num != 0)
  58.  
  59. # --- Display the results ---
  60. print("📊 Frequency of Numbers (1-64) Across All Six Tables\n")
  61.  
  62. # Print a formatted table header
  63. print(f"{'Number':<10} | {'Frequency':<10}")
  64. print("-" * 24)
  65.  
  66. # Print each number and its corresponding frequency
  67. for number in range(1, 65):
  68. count = frequencies[number]
  69. print(f"{number:<10} | {count:<10}")
  70.  
  71.  
Success #stdin #stdout 0.08s 14140KB
stdin
Standard input is empty
stdout
📊 Frequency of Numbers (1-64) Across All Six Tables

Number     | Frequency 
------------------------
1          | 5         
2          | 1         
3          | 1         
4          | 3         
5          | 3         
6          | 4         
7          | 2         
8          | 3         
9          | 3         
10         | 1         
11         | 3         
12         | 3         
13         | 2         
14         | 3         
15         | 3         
16         | 4         
17         | 3         
18         | 2         
19         | 2         
20         | 5         
21         | 2         
22         | 2         
23         | 4         
24         | 2         
25         | 4         
26         | 3         
27         | 1         
28         | 4         
29         | 4         
30         | 2         
31         | 2         
32         | 2         
33         | 2         
34         | 2         
35         | 2         
36         | 4         
37         | 5         
38         | 0         
39         | 2         
40         | 5         
41         | 2         
42         | 4         
43         | 2         
44         | 2         
45         | 4         
46         | 3         
47         | 3         
48         | 2         
49         | 3         
50         | 4         
51         | 4         
52         | 1         
53         | 3         
54         | 3         
55         | 1         
56         | 3         
57         | 4         
58         | 1         
59         | 3         
60         | 4         
61         | 3         
62         | 1         
63         | 1         
64         | 5