{"id":28336795,"url":"https://github.com/ksprugevics/magic-square","last_synced_at":"2026-04-21T10:03:10.844Z","repository":{"id":190121277,"uuid":"680426790","full_name":"ksprugevics/magic-square","owner":"ksprugevics","description":"Some simple algorithm implementations for solving (ordinary) magic squares using NumPy","archived":false,"fork":false,"pushed_at":"2023-08-23T06:39:54.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T05:05:53.810Z","etag":null,"topics":["algorithms","mathematics","numpy","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksprugevics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-19T07:45:24.000Z","updated_at":"2023-08-23T06:44:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"2de62abb-c543-4663-a123-a3414935277f","html_url":"https://github.com/ksprugevics/magic-square","commit_stats":null,"previous_names":["ksprugevics/magic-square"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ksprugevics/magic-square","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksprugevics%2Fmagic-square","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksprugevics%2Fmagic-square/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksprugevics%2Fmagic-square/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksprugevics%2Fmagic-square/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksprugevics","download_url":"https://codeload.github.com/ksprugevics/magic-square/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksprugevics%2Fmagic-square/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266462797,"owners_count":23932867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","mathematics","numpy","python"],"created_at":"2025-05-26T23:15:46.744Z","updated_at":"2026-04-21T10:03:10.795Z","avatar_url":"https://github.com/ksprugevics.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Magic square finding algorithms\n\nThis repo contains some algorithm implementations of solving [ordinary magic squares](https://en.wikipedia.org/wiki/Magic_square#Classification_of_magic_squares)\n\nI don't claim to be an author of any of the algorithms, these are just my implementations using NumPy. The script contains a main method for testing and the following algorithms defined as seperate functions:\n\n0. **validate(numbers, size)** - validates whether a given matrix is an ordinary magic square\n1. **calculateMagicConstant(size)** - calculates the magic constant, given the size of the matrix\n2. **bogoSolveMagicSquare(size)** - shuffles the matrix until a magic square is found (very slow)\n3. **oddMagicSquareSolve(size, startNumber)** - given the size and starting number, finds a magic square. Only works with odd values of n. Based on https://www.1728.org/magicsq1.htm\n4. **oddMagicSquareSolve2(size)** - given the size, finds a magic square. Only works with odd values of n. Based on https://www.geeksforgeeks.org/magic-square/\n5. **doublyEvenMagicSquareSolve(size)** - given the size, finds a magic square. Only works with doubly-even (divisible by 4) values of n. Based on https://www.1728.org/magicsq2.htm\n6. **singlyEvenMagicSquareSolve(size)** - given the size, finds a magic square. Only works with singly-even (divisible by 2 but not by 4) values of n. Based on https://www.1728.org/magicsq3.htm\n\n\n\nSize in the function definitions correspond to n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksprugevics%2Fmagic-square","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksprugevics%2Fmagic-square","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksprugevics%2Fmagic-square/lists"}