{"id":20402558,"url":"https://github.com/willdunklin/closest_factors","last_synced_at":"2026-04-20T07:04:55.982Z","repository":{"id":119680240,"uuid":"353433200","full_name":"willdunklin/closest_factors","owner":"willdunklin","description":null,"archived":false,"fork":false,"pushed_at":"2021-03-31T17:22:30.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-05T01:45:18.606Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/willdunklin.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}},"created_at":"2021-03-31T17:11:24.000Z","updated_at":"2021-03-31T17:22:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"ba16acd0-2127-4ad0-8f37-7a6fc65dca6c","html_url":"https://github.com/willdunklin/closest_factors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/willdunklin/closest_factors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdunklin%2Fclosest_factors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdunklin%2Fclosest_factors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdunklin%2Fclosest_factors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdunklin%2Fclosest_factors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willdunklin","download_url":"https://codeload.github.com/willdunklin/closest_factors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdunklin%2Fclosest_factors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32036803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2024-11-15T04:54:41.376Z","updated_at":"2026-04-20T07:04:55.965Z","avatar_url":"https://github.com/willdunklin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# closest_factors\n\nHere we're trying to get the nearest factors of a number n.\n\nSpecifically we want numbers `a,b` such that `n = a*b`, while minimizing `|a-b|`.\n\n### A use case:\nFor example, if you want to convert a 1d array of length `n` into the most square 2d matrix possible,\nthis algorithm efficiently shows what the dimensions `a,b` of that matrix should be for `n`.\n\n## Usage\n\n```\nclosest_factors(34929)\n\u003e (3881, 9)\n\nclosest_factors(429538750)\n\u003e (343631, 1250)\n\nclosest_factors(25)\n\u003e (5, 5)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilldunklin%2Fclosest_factors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilldunklin%2Fclosest_factors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilldunklin%2Fclosest_factors/lists"}