There were 4 absences, leaving 26 students, 14 with red markers and 12 with blue.
The sums for the red-marked cubes were both 49, each containing 7 1's and 7 6's. For the blue cubes, the sums were 37 (7 1's and 5 6's) and 47 (5 1's and 7 6's).
DATA 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73
DATA 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163
DATA 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251
CLS
DIM prim(42)
DO
i = i + 1
READ prim(i)
LOOP UNTIL prim(i) > 180
nPrimes = i
PRINT nPrimes
FOR absent = 1 TO 29
class = 30 - absent
FOR red = 1 TO class - 1
blue = class - red
FOR left1 = 0 TO red
leftSum = left1 + 6 * (red - left1): rightSum = 6 * left1 + (red - left1)
sr1 = INT(SQR(leftSum) + .5): sr2 = INT(SQR(rightSum) + .5)
IF sr1 * sr1 = leftSum AND sr2 * sr2 = rightSum THEN
FOR left1b = 1 TO blue - 1
leftSum = left1b: rightSum = 6 * (blue - left1b)
leftSum = left1b + 6 * (blue - left1b): rightSum = 6 * left1b + (blue - left1b)
IF leftSum / rightSum > 1 AND leftSum / rightSum < 2 OR rightSum / leftSum > 1 AND rightSum / leftSum < 2 THEN
FOR i = 1 TO nPrimes
IF leftSum = prim(i) THEN good1 = 1
IF rightSum = prim(i) THEN good2 = 1
NEXT i
IF good1 AND good2 THEN
PRINT absent; class, red; blue, left1; left1b
END IF
END IF
NEXT left1b
END IF
NEXT left1
NEXT red
NEXT absent
Based on "A question of symmetry", Enigma No. 1509, by Adrian Somerfield, New Scientist, 30 August 2008.
|