{"id":34320229,"url":"https://github.com/lukius/fmtgp","last_synced_at":"2026-03-12T18:48:58.210Z","repository":{"id":24611010,"uuid":"28019768","full_name":"lukius/fmtgp","owner":"lukius","description":"From Mathematics to Generic Programming","archived":false,"fork":false,"pushed_at":"2015-01-02T05:27:21.000Z","size":2256,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-20T23:56:59.211Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-15T04:00:29.000Z","updated_at":"2025-06-09T14:20:00.000Z","dependencies_parsed_at":"2022-08-23T04:31:31.884Z","dependency_job_id":null,"html_url":"https://github.com/lukius/fmtgp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lukius/fmtgp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukius%2Ffmtgp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukius%2Ffmtgp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukius%2Ffmtgp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukius%2Ffmtgp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukius","download_url":"https://codeload.github.com/lukius/fmtgp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukius%2Ffmtgp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30438528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2025-12-17T13:23:26.268Z","updated_at":"2026-03-12T18:48:58.205Z","avatar_url":"https://github.com/lukius.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"* This repository contains solutions -and related work- for some of the exercises presented in [From Mathematics to Generic Programming](http://www.amazon.com/Mathematics-Generic-Programming-Alexander-Stepanov/dp/0321942043). So far,\n\n\n**Chapter 3: Ancient Greek Number Theory**\n  - [X] Exercise 3.6: Prove that if `n` and `m` are coprime, then `sigma(nm) = sigma(n) sigma(m)`.\n  - [X] Exercise 3.7: Prove that every even perfect number is a triangular number.\n  - [X] Exercise 3.8: Prove that the sum of the reciprocals of the divisors of a perfect number is always 2.\n\n**Chapter 4: Euclid's Algorithm**\n  - [X] Exercise 4.3: Prove that `sqrt_3(16) + sqrt_3(54) = sqrt_3(250)`.\n  - [X] Exercise 4.4: Prove that, for any odd square number `x` there is an even square number `y` such that `x+y` is a square number.\n  - [X] Exercise 4.5: Prove that, if `x` and `y` are both sums of two squares, then so is their product `xy`.\n\n**Chapter 5: The Emergence of Modern Number Theory**\n  - [X] Exercise 5.1: Prove that if `n \u003e 4` is composite, then `(n-1)!` is a multiple of `n`.\n\n**Chapter 6: Abstraction in Mathematics**\n  - [X] Exercise 6.3: Prove that any group has at least one element.\n  - [X] Exercise 6.4: What is the order of `e`? Prove that `e` is the only element of such order.\n  - [X] Exercise 6.5: Prove that if `a` is an element of order `n`, then `a^{-1} = a^{n-1}`.\n  - [X] Exercise 6.7: Prove that any subgroup of a cyclic group is cyclic.\n  - [X] Exercise 6.8: Prove that any cyclic group is abelian.\n  - [X] Exercise 6.10: Prove that every group of prime order is cyclic.\n\n**Chapter 7: Deriving a Generic Algorithm**\n  - [X] Exercise 7.1: How many additions are needed to compute `fib0(n)`?\n  - [X] Exercise 7.2: Implement Fibonacci numbers using `power` (code for solving arbitrary linear recurrences also provided).\n\n**Chapter 8: More Algebraic Structures**\n  - [X] Exercise 8.7: Compute the transitive closure of a graph using matrix multiplication on boolean semirings.\n  - [X] Exercise 8.8: Compute shortest paths on a graph using matrix multiplication on tropical semirings.\n\n**Chapter 11: Permutation Algorithms**\n  - [X] Exercise 11.1: Prove Cayley's theorem.\n  - [X] Exercise 11.2: What is the order of Sn?\n  - [X] Exercise 11.3: Prove that if n \u003e 2, Sn is not abelian.\n  - [X] Exercise 11.5: Design an in-place reverse algorithm for forward iterators.\n  - [X] Exercise 11.9: Prove that if a rotation of `n` elements has a trivial cycle, then it has `n` trivial cycles.\n  - [X] Exercise 11.11: How many assignments does 3-reverse rotate perform?\n\n**Chapter 12: Extensions of GCD**\n  - [X] Exercise 12.2: \n        * Prove that an ideal `I` is closed under subtraction.\n        * Prove that `I` contains 0.\n  - [X] Exercise 12.3: Prove that all the elements of a linear combination ideal are divisible by any of the common divisors of `a` and `b`.\n  - [X] Exercise 12.4: Prove that any element in a principal ideal is divisible by the principal element.\n  - [X] Exercise 12.5: Using Bézout's identity, prove that if `p` is prime, then any 0 \u003c `a` \u003c `p` has multiplicative inverse modulo `p`. \n  - [X] Exercise 12.7: Develop a version of the extended GCD algorithm based on Stein's algorithm.\n\n**Chapter 13: A Real-World Application**\n  - [X] Exercise 13.1: Implement the function `bool is_carmichael(n)`.\n  - [X] Exercise 13.2: Find the first seven Carmichael numbers using your function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukius%2Ffmtgp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukius%2Ffmtgp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukius%2Ffmtgp/lists"}