magicສີ່ຫລ່ຽມມະຫັດສະຈັນ
ສີ່ຫລ່ຽມມະຫັດສະຈັນ - Carré Magique - Magic Square
ສີ່ຫລ່ຽມມະຫັດສະຈັນ ແມ່ນ ເລກຄູນເລກ ແຕ່ 1ຮອດ ນ² ທີ່ເຮັດໃຫ້ ເລກ ແຈກກະຈ່າຍກັນໄປ ເພື່ອຈະໃຫ້ ເລກບວກຂອງ ເສັ້ນນອນ ເສັ້ນຕັ້ງ ແລະ ເສັ້ນມູມ ມີຈໍານວນອັນດຽວກັນ = ນ(ນ²+1)/2.
ຕົວຢ່າງ ສີ່ຫລ່ຽມ3x3 ແມ່ນ ສີ່ຫລ່ຽມ 3x3=9 ມີ 9 ຫ້ອງ ແຕ່ລະຫ້ອງ ມີເລກ 1 ຫາ 9 ເພຶ່ອຈະໃດ້ ສີ່ຫລ່ຽມມະຫັດສະຈັນ ຕ້ອງ
■ ຜົນລວມເລກໝົດທູກເສັ້ນ 1+2+..+9 ຫຼື ນ(ນ²+1)/2 => 3(3²+1)/2 = 45
■ ຜົນລວມເລກ ແຕ່ລະເສັ້ນຂອງ ເສັ້ນນອນ(horizontal) ເສັ້ນຕັ້ງ(vertical) ເສັ້ນມູມ(diagonal) 45/3 = 15
■ ເລກ3ເສັ້ນນອນ(h) ບວກ ກັນ ໃຫ້ໃດ້ = 15
■ ເລກ3ເສັ້ນຕັ້ງ(v) ບວກ ກັນ ໃຫ້ໃດ້ = 15
■ ເລກ2ເສັ້ນມູມ(d) ບວກ ກັນ ໃຫ້ໃດ້ = 15
ຕາມທໍາມະດາ ມີ 3 ຂໍ້:
■ ເລກຄີກ(3, 5, 7...)
■ ເລກທີ່ຫານໃຫ້4(4, 8, 12...) ແລະ
■ ເລກທີ່ເຫຼືອ(6, 10...)
ວິທີປ່ຽນເລກ ຕາມທໍາມະດາ ມີ 3 ຂໍ້:
■ ເລກຄີກ(3, 5, 7...)
■ ເລກທີ່ຫານໃຫ້4(4, 8, 12...) ແລະ
■ ເລກທີ່ເຫຼືອ(6, 10...)
ຕົ່ວຢ່າງນີ້ແມ່ນເລກຂູ່
ສີ່ຫລ່ຽມ4x4 ມີ 16 ຫ້ອງແຕ່ລະຫ້ອງມີເລກ 1 ຫາ 16 ເພຶ່ອຈະໃດ້ ສີ່ຫລ່ຽມມະຫັດສະຈັນ ຕ້ອງຍ້າຍເລກຈາກກະດານ1ຫາກະດານ2
1.ກ/ ປ່ຽນເລກຕົງກັນຂ້າມຂອງ2ເສັ້ນນອນ(2-3)ກະດານ1ມາໃສ່ກະດານ2
■ ເລກ 5 - 12 -> 12 - 5
■ ເລກ 8 - 9 -> 9 - 8
1.ຂ/ ປ່ຽນເລກຕົງກັນຂ້າມຂອງ2ເສັ້ນຕັ້ງ(2-3)
■ ເລກ 2 - 15 -> 15 - 2
■ ເລກ 3 - 14 -> 14 - 3
ຫຼື
2.ກ/ ປ່ຽນເລກຕົງກັນຂ້າມຂອງ2ເສັ້ນມູມ(1-4)ກະດານ1ມາໃສ່ກະດານ2
■ ເລກ 1 - 16 -> 16 - 1
■ ເລກ 4 - 13 -> 13 - 4
2.ຂ/ ປ່ຽນເລກຕົງກັນຂ້າມຂອງ2ເສັ້ນມູມກາງ(1-4)
■ ເລກ 6 - 11 -> 11 - 6
■ ເລກ 7 - 10 -> 10 - 7
Un carré magique est une matrice n x n où les nombres de 1 à n2
sont disposés de sorte que la somme de tous des lignes, colonnes ou diagonales soit la même, égale à n(n2 + 1) / 2.
Pour générer des carrés de toutes les valeurs de n , du simple cas où n est impair.
Utiliser les algorithmes de Shin's Magic Square World comme base pour la mise en œuvre.
En général, il y a trois cas distincts à considérer lors de la génération d'un carré magique:
■ La série de nombres impairs ( n = 3, 5, 7, ...)
Cet algorithme est bien connu.
■ Une série multiple de 4 ( n = 4, 8, 12, ...)
Cette solution est également assez courante.
■ Le reste ( n = 6, 10, 14, ...)
Shin déclare que seuls quelques carrés magiques de cette série étaient connus jusqu'à présent.
A Magic Square is an n x n matrix where the numbers from 1 to n2
are arranged so that the sum of any row, column, or diagonal is the same, equal to n(n2 + 1) / 2.
Generate squares for all values of n, instead of just the simple case where n is odd. Use the algorithms on
Shin's Magic Square World as the basis for implementation.
In general, there are three separate cases to consider when generating a Magic Square:
■ The odd number series (n = 3, 5, 7, ...). This algorithm is well-known.
■ A multiple-of-4 series (n = 4, 8, 12, ...) This solution is also fairly common.
■ The rest (n = 6, 10, 14, ...) Shin states that only a few Magic Squares of this series have been known until recently.
ເຢັນສະບາຍ ເຢັນສະບາຍDiscover Laos on Motorcycle
ເຢັນສະບາຍ ຊາວນາDécouvrir Laos en cyclomoteur

Commentaires