All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Self-Cardinality (Posted on 2010-05-07) Difficulty: 3 of 5
Arrange nine digits in a 3x3 array such that each different digit that appears appears as many times as its cardinality, so for example, if the digit 3 appears at all, it appears 3 times. Also the eight 3-digit numbers formed from the rows, columns (top to bottom) and two diagonals (also top to bottom) must all be different.

Also, the sum of the nine digits used cannot itself be written using the digits you've included in the array.

What is that sum of these nine digits?

  Submitted by Charlie    
Rating: 3.0000 (1 votes)
Solution: (Hide)
The different digits used must sum to 9, so that all the positions in the array are filled and no more. The sets of different digits can be:

 9
 8  1
 7  2
 6  3
 6  2  1
 5  4
 5  3  1
 4  3  2

Clearly, nine 9's will not allow for all eight 3-digit numbers to be different, and likewise for eight 8's and one 1.

The following program checks the other possibilities:

DECLARE SUB permute (a$)
DATA 777777722, 666666333, 666666221, 555554444, 555553331, 444433322

CLS

FOR tp = 1 TO 6: READ s$
   sod = 0
   FOR i = 1 TO 9
     sod = sod + VAL(MID$(s$, i, 1))
   NEXT
   PRINT s$; sod

   sh$ = s$
   DO
     s1$ = LEFT$(s$, 3)
     s2$ = MID$(s$, 4, 3)
     s3$ = RIGHT$(s$, 3)
     IF s1$ <> s2$ AND s2$ <> s3$ AND s1$ <> s3$ THEN
      s4$ = MID$(s$, 1, 1) + MID$(s$, 4, 1) + MID$(s$, 7, 1)
      IF s4$ <> s1$ AND s4$ <> s2$ AND s4$ <> s3$ THEN
       s5$ = MID$(s$, 2, 1) + MID$(s$, 5, 1) + MID$(s$, 8, 1)
      IF s5$ <> s1$ AND s5$ <> s2$ AND s5$ <> s3$ AND s5$ <> s4$ THEN
       s6$ = MID$(s$, 3, 1) + MID$(s$, 6, 1) + MID$(s$, 9, 1)
      IF s6$ <> s1$ AND s6$ <> s2$ AND s6$ <> s3$ AND s6$ <> s4$ 
                AND s6$ <> s5$ THEN
       s7$ = MID$(s$, 1, 1) + MID$(s$, 5, 1) + MID$(s$, 9, 1)
      IF s7$ <> s1$ AND s7$ <> s2$ AND s7$ <> s3$ AND s7$ <> s4$ 
                AND s7$ <> s5$ AND s7$ <> s6$ THEN
       s8$ = MID$(s$, 3, 1) + MID$(s$, 5, 1) + MID$(s$, 7, 1)
      IF s8$ <> s1$ AND s8$ <> s2$ AND s8$ <> s3$ AND s8$ <> s4$ 
                AND s8$ <> s5$ AND s8$ <> s6$ AND s8$ <> s7$ THEN
        PRINT sod;
      END IF
      END IF
      END IF
      END IF
      END IF
     END IF

     permute s$
   LOOP UNTIL s$ = sh$
NEXT tp

END

SUB permute (a$)
DEFINT A-Z
 x$ = ""
 FOR i = LEN(a$) TO 1 STEP -1
  l$ = x$
  x$ = MID$(a$, i, 1)
  IF x$ < l$ THEN EXIT FOR
 NEXT

 IF i = 0 THEN
  FOR j = 1 TO LEN(a$) \\ 2
   x$ = MID$(a$, j, 1)
   MID$(a$, j, 1) = MID$(a$, LEN(a$) - j + 1, 1)
   MID$(a$, LEN(a$) - j + 1, 1) = x$
  NEXT
 ELSE
  FOR j = LEN(a$) TO i + 1 STEP -1
   IF MID$(a$, j, 1) > x$ THEN EXIT FOR
  NEXT
  MID$(a$, i, 1) = MID$(a$, j, 1)
  MID$(a$, j, 1) = x$
  FOR j = 1 TO (LEN(a$) - i) \\ 2
   x$ = MID$(a$, i + j, 1)
   MID$(a$, i + j, 1) = MID$(a$, LEN(a$) - j + 1, 1)
   MID$(a$, LEN(a$) - j + 1, 1) = x$
  NEXT
 END IF
END SUB

The resulting output is

777777722 53
666666333 45
666666221 41
555554444 41
555553331 35
 35  35  35  35  35  35  35  35  35  35  35  35  35  35  35  35  35  35
444433322 29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29
 29  29  29  29  29  29  29  29  29  29  29  29  29  29  29  29

Only two sets of digits, 555553331 and 444433322, allow for the formation of eight different 3-digit numbers. The former, however, has a sum of digits equal to 35, which is in fact formable from the digits of itself, and therefore cannot count.

Thus the digits used are 444433322, whose sum is the answer: 29. This value is shown 276 times, indicating there are 276 ways of arranging these so that all eight 3-digit numbers as defined are different.

The ways are:

223 224 224 224 224 232 232 233 233 233 233 233 233 233 234 234 234 234 234 234
434 343 344 434 434 434 434 424 434 434 444 444 444 444 244 344 423 424 424 432
443 443 334 334 343 344 443 434 244 424 234 324 423 432 433 324 443 334 343 443

234 234 234 234 234 234 234 234 242 242 242 243 243 243 243 243 243 243 243 243
433 434 434 442 442 443 444 444 343 343 434 234 323 334 342 342 343 343 423 424
442 243 342 334 433 423 233 332 344 443 334 443 444 244 344 434 424 442 443 433

243 243 243 243 243 243 244 244 244 244 244 244 244 244 244 244 244 244 244 244
432 432 433 433 434 434 234 323 324 324 332 334 334 334 334 334 342 342 343 343
434 443 244 442 423 432 343 344 343 433 344 243 324 342 423 432 343 433 342 423

244 244 322 323 323 324 324 324 324 324 324 324 324 324 324 324 324 324 324 324
432 434 434 434 434 244 342 342 343 343 344 344 344 423 432 432 433 433 434 434
343 323 344 244 442 334 434 443 424 442 243 423 432 443 344 443 244 442 234 243

324 324 324 324 324 324 324 324 332 332 332 332 332 332 334 334 334 334 334 334
434 442 442 443 443 443 444 444 424 424 444 444 444 444 242 242 243 243 244 244
342 334 433 234 243 423 233 332 434 443 234 324 423 432 434 443 424 442 234 243

334 334 334 334 334 334 334 334 334 334 342 342 342 342 342 342 342 342 342 342
244 244 244 422 423 424 424 424 442 442 234 243 243 323 324 343 343 344 423 423
324 423 432 443 442 234 243 342 324 432 344 434 443 444 443 244 424 423 344 443

342 342 342 342 342 342 342 342 342 342 342 342 342 343 343 343 343 343 343 343
424 424 432 432 432 433 434 434 434 442 442 443 443 234 234 243 243 423 423 424
334 433 344 434 443 442 324 423 432 334 433 324 423 244 442 244 442 244 442 234

343 343 343 343 343 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344
424 432 432 434 434 224 234 234 234 234 234 242 243 323 324 324 324 324 342 343
432 244 442 224 422 433 243 324 342 423 432 433 423 244 243 342 423 432 243 242

344 344 344 344 344 344 422 422 422 423 423 423 423 423 423 423 423 423 423 423
343 423 424 432 434 434 334 343 434 244 323 334 342 343 344 432 432 433 433 434
422 243 233 342 232 322 344 344 343 433 444 244 344 424 243 344 443 244 442 243

423 423 423 423 423 423 424 424 424 424 424 424 424 424 432 432 432 432 432 432
442 442 443 443 444 444 234 342 343 343 343 343 343 434 234 243 323 343 344 344
334 433 234 432 233 332 334 433 234 243 324 342 423 332 344 434 444 424 324 423

432 432 432 432 432 432 432 432 432 432 433 433 433 433 433 433 433 433 433 433
423 423 424 424 433 434 442 442 444 444 234 242 243 244 244 244 244 244 423 424
344 434 343 433 244 423 334 433 233 332 244 434 244 234 243 324 423 432 244 243

433 433 433 433 433 433 433 434 434 434 434 434 434 434 434 434 434 434 442 442
424 432 432 434 434 442 443 234 234 242 242 243 243 324 342 342 424 424 234 234
432 244 424 242 422 423 422 243 342 334 433 342 423 234 234 243 233 332 334 343

442 442 442 442 442 442 442 442 442 442 442 442 442 442 442 442 443 443 443 443
323 324 324 334 334 334 334 342 342 343 432 432 433 433 434 434 233 234 234 234
443 334 343 234 324 342 423 334 343 243 334 343 324 342 323 332 442 243 324 423

443 443 443 443 443 443 443 443 443 443 443 443 444 444 444 444
243 243 323 324 324 343 343 432 432 433 434 434 323 323 323 323
324 342 442 234 243 224 242 234 243 224 223 232 234 243 324 342

From Enigma No. 1584, "Trisquare", by Adrian Somerfield, New Scientist, 27 February 2010, page 26.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Some ThoughtsPuzzle AnswerK Sengupta2023-12-12 05:43:06
re(3): A possible solutionDaniel2010-05-08 01:05:47
Some Thoughtsre(2): A possible solutionAdy TZIDON2010-05-07 17:39:12
No problemed bottemiller2010-05-07 14:07:37
re: A possible solutionDaniel2010-05-07 14:05:34
SolutionA possible solutionAdy TZIDON2010-05-07 13:21:12
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (14)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information