mirror of
https://github.com/rzmk/ladderz.git
synced 2025-12-26 02:57:00 +00:00
deploy: c63e973140
This commit is contained in:
parent
78c9ee1c67
commit
5d00665ae7
22 changed files with 163 additions and 319 deletions
|
|
@ -117,7 +117,7 @@
|
|||
//! Now in `src/main.rs` let's replace the contents with the following code:
|
||||
//!
|
||||
//! ```rust
|
||||
//! use ladderz::pre_algebra::unit1::{get_factor_pairs, get_factors};
|
||||
//! use ladderz::pre_algebra::{get_factors, get_factor_pairs};
|
||||
//! use std::env;
|
||||
//!
|
||||
//! fn main() {
|
||||
|
|
@ -173,7 +173,7 @@
|
|||
//!
|
||||
//! The printed output should be:
|
||||
//!
|
||||
//! ```
|
||||
//! ```console
|
||||
//! List of factors of 12: [1, 2, 3, 4, 6, 12]
|
||||
//! List of factor pairs of 12: [(1, 12), (2, 6), (3, 4)]
|
||||
//! ```
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Source of the Rust file `src/pre_algebra.rs`."><title>pre_algebra.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-9bb858ba049f1f21.css" id="mainThemeStyle"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="ladderz" data-themes="" data-resource-suffix="" data-rustdoc-version="1.72.1 (d5c2e9c34 2023-09-13)" data-channel="1.72.1" data-search-js="search-f6292fe389d70017.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ><script src="../../static.files/storage-59fd9b8ccb335783.js"></script><script defer src="../../static.files/source-script-106908c7a7964ba4.js"></script><script defer src="../../source-files.js"></script><script defer src="../../static.files/main-0795b7d26be81095.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc source"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><main><nav class="sub"><a class="sub-logo-container" href="../../ladderz/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||
<a href="#2" id="2">2</a>
|
||||
</pre></div><pre class="rust"><code><span class="doccomment">/// Factors and multiples
|
||||
</span><span class="kw">pub mod </span>unit1;
|
||||
</code></pre></div></section></main></body></html>
|
||||
11
src/ladderz/pre_algebra/mod.rs.html
Normal file
11
src/ladderz/pre_algebra/mod.rs.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Source of the Rust file `src/pre_algebra/mod.rs`."><title>mod.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-9bb858ba049f1f21.css" id="mainThemeStyle"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="ladderz" data-themes="" data-resource-suffix="" data-rustdoc-version="1.72.1 (d5c2e9c34 2023-09-13)" data-channel="1.72.1" data-search-js="search-f6292fe389d70017.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ><script src="../../../static.files/storage-59fd9b8ccb335783.js"></script><script defer src="../../../static.files/source-script-106908c7a7964ba4.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../static.files/main-0795b7d26be81095.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc source"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><main><nav class="sub"><a class="sub-logo-container" href="../../../ladderz/index.html"><img class="rust-logo" src="../../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="example-wrap"><div data-nosnippet><pre class="src-line-numbers"><a href="#1" id="1">1</a>
|
||||
<a href="#2" id="2">2</a>
|
||||
<a href="#3" id="3">3</a>
|
||||
<a href="#4" id="4">4</a>
|
||||
<a href="#5" id="5">5</a>
|
||||
</pre></div><pre class="rust"><code><span class="doccomment">/// Factors and multiples
|
||||
</span><span class="kw">mod </span>unit1;
|
||||
|
||||
<span class="attr">#[doc(inline)]
|
||||
</span><span class="kw">pub use </span>unit1::<span class="kw-2">*</span>;
|
||||
</code></pre></div></section></main></body></html>
|
||||
|
|
@ -209,116 +209,19 @@
|
|||
<a href="#209" id="209">209</a>
|
||||
<a href="#210" id="210">210</a>
|
||||
<a href="#211" id="211">211</a>
|
||||
<a href="#212" id="212">212</a>
|
||||
<a href="#213" id="213">213</a>
|
||||
<a href="#214" id="214">214</a>
|
||||
<a href="#215" id="215">215</a>
|
||||
<a href="#216" id="216">216</a>
|
||||
<a href="#217" id="217">217</a>
|
||||
<a href="#218" id="218">218</a>
|
||||
<a href="#219" id="219">219</a>
|
||||
<a href="#220" id="220">220</a>
|
||||
<a href="#221" id="221">221</a>
|
||||
<a href="#222" id="222">222</a>
|
||||
<a href="#223" id="223">223</a>
|
||||
<a href="#224" id="224">224</a>
|
||||
<a href="#225" id="225">225</a>
|
||||
<a href="#226" id="226">226</a>
|
||||
<a href="#227" id="227">227</a>
|
||||
<a href="#228" id="228">228</a>
|
||||
<a href="#229" id="229">229</a>
|
||||
<a href="#230" id="230">230</a>
|
||||
<a href="#231" id="231">231</a>
|
||||
<a href="#232" id="232">232</a>
|
||||
<a href="#233" id="233">233</a>
|
||||
<a href="#234" id="234">234</a>
|
||||
<a href="#235" id="235">235</a>
|
||||
<a href="#236" id="236">236</a>
|
||||
<a href="#237" id="237">237</a>
|
||||
<a href="#238" id="238">238</a>
|
||||
<a href="#239" id="239">239</a>
|
||||
<a href="#240" id="240">240</a>
|
||||
<a href="#241" id="241">241</a>
|
||||
<a href="#242" id="242">242</a>
|
||||
<a href="#243" id="243">243</a>
|
||||
<a href="#244" id="244">244</a>
|
||||
<a href="#245" id="245">245</a>
|
||||
<a href="#246" id="246">246</a>
|
||||
<a href="#247" id="247">247</a>
|
||||
<a href="#248" id="248">248</a>
|
||||
<a href="#249" id="249">249</a>
|
||||
<a href="#250" id="250">250</a>
|
||||
<a href="#251" id="251">251</a>
|
||||
<a href="#252" id="252">252</a>
|
||||
<a href="#253" id="253">253</a>
|
||||
<a href="#254" id="254">254</a>
|
||||
<a href="#255" id="255">255</a>
|
||||
<a href="#256" id="256">256</a>
|
||||
<a href="#257" id="257">257</a>
|
||||
<a href="#258" id="258">258</a>
|
||||
<a href="#259" id="259">259</a>
|
||||
<a href="#260" id="260">260</a>
|
||||
<a href="#261" id="261">261</a>
|
||||
<a href="#262" id="262">262</a>
|
||||
<a href="#263" id="263">263</a>
|
||||
<a href="#264" id="264">264</a>
|
||||
<a href="#265" id="265">265</a>
|
||||
<a href="#266" id="266">266</a>
|
||||
<a href="#267" id="267">267</a>
|
||||
<a href="#268" id="268">268</a>
|
||||
<a href="#269" id="269">269</a>
|
||||
<a href="#270" id="270">270</a>
|
||||
<a href="#271" id="271">271</a>
|
||||
<a href="#272" id="272">272</a>
|
||||
<a href="#273" id="273">273</a>
|
||||
<a href="#274" id="274">274</a>
|
||||
<a href="#275" id="275">275</a>
|
||||
<a href="#276" id="276">276</a>
|
||||
<a href="#277" id="277">277</a>
|
||||
<a href="#278" id="278">278</a>
|
||||
<a href="#279" id="279">279</a>
|
||||
<a href="#280" id="280">280</a>
|
||||
<a href="#281" id="281">281</a>
|
||||
<a href="#282" id="282">282</a>
|
||||
<a href="#283" id="283">283</a>
|
||||
<a href="#284" id="284">284</a>
|
||||
<a href="#285" id="285">285</a>
|
||||
<a href="#286" id="286">286</a>
|
||||
<a href="#287" id="287">287</a>
|
||||
<a href="#288" id="288">288</a>
|
||||
<a href="#289" id="289">289</a>
|
||||
<a href="#290" id="290">290</a>
|
||||
<a href="#291" id="291">291</a>
|
||||
<a href="#292" id="292">292</a>
|
||||
</pre></div><pre class="rust"><code><span class="kw">use </span>std::collections::HashSet;
|
||||
|
||||
<span class="doccomment">/// Finds all factor pairs for a positive integer `n`.
|
||||
///
|
||||
/// # Challenge
|
||||
///
|
||||
/// Write a program that finds all the factor pairs for a number `n`.
|
||||
///
|
||||
/// # Description
|
||||
///
|
||||
/// Generates a `HashSet` of factor pairs for a positive integer `n`.
|
||||
///
|
||||
/// This function calculates and returns a `HashSet` containing all unique factor pairs
|
||||
/// This function calculates and returns a `HashSet<(u32, u32)>` containing all unique factor pairs
|
||||
/// of the input positive integer `n`. A factor pair is a pair of positive integers
|
||||
/// `(a, b)` where `a` and `b` are both factors of `n` (i.e., `a * b == n`).
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `n` - The positive integer for which factor pairs are to be calculated.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A `HashSet` containing all unique factor pairs of the input integer `n`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use std::collections::HashSet;
|
||||
/// use ladderz::pre_algebra::unit1::get_factor_pairs;
|
||||
/// use ladderz::pre_algebra::get_factor_pairs;
|
||||
///
|
||||
/// fn main() {
|
||||
/// let result_pairs = get_factor_pairs(12);
|
||||
|
|
@ -351,31 +254,15 @@
|
|||
|
||||
<span class="doccomment">/// Finds all factors of a positive integer `n`.
|
||||
///
|
||||
/// # Challenge
|
||||
///
|
||||
/// Write a program that finds all the factors of a number. Assume that `n` is a positive integer greater than or equal to 1.
|
||||
///
|
||||
/// # Description
|
||||
///
|
||||
/// Generates a `HashSet` of factors for a positive integer `n`.
|
||||
///
|
||||
/// This function calculates and returns a `HashSet` containing all unique factors
|
||||
/// This function calculates and returns a `HashSet<u32>` containing all unique factors
|
||||
/// of the input positive integer `n`. A factor of `n` is a positive integer `a` where
|
||||
/// `n` is evenly divisible by `a` (i.e., `n % a == 0`).
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `n` - The positive integer for which factors are to be calculated.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A `HashSet` containing all unique factors of the input integer `n`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use std::collections::HashSet;
|
||||
/// use ladderz::pre_algebra::unit1::get_factors;
|
||||
/// use ladderz::pre_algebra::get_factors;
|
||||
///
|
||||
/// fn main() {
|
||||
/// let result_factors = get_factors(16);
|
||||
|
|
@ -402,29 +289,12 @@
|
|||
|
||||
<span class="doccomment">/// Checks if a positive integer `x` is a factor of another positive integer `y`.
|
||||
///
|
||||
/// # Challenge
|
||||
///
|
||||
/// Write a program that determines whether one positive integer is a factor of another.
|
||||
///
|
||||
/// # Description
|
||||
///
|
||||
/// Checks if a positive integer `x` is a factor of another positive integer `y`.
|
||||
///
|
||||
/// A factor of `y` is a positive integer `x` where `y` is evenly divisible by `x` (i.e., `y % x == 0`).
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `x` - The positive integer to determine whether it is a factor of `y` or not.
|
||||
/// * `y` - The positive integer for which the factor check of `x` is performed.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `true` if `x` is a factor of `y`, `false` otherwise.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use ladderz::pre_algebra::unit1::is_factor;
|
||||
/// use ladderz::pre_algebra::is_factor;
|
||||
///
|
||||
/// fn main() {
|
||||
/// assert!(is_factor(2, 16)); // 2 is a factor of 16
|
||||
|
|
@ -442,29 +312,12 @@
|
|||
|
||||
<span class="doccomment">/// Checks if a positive integer `x` is a multiple of another positive integer `y`.
|
||||
///
|
||||
/// # Challenge
|
||||
///
|
||||
/// Write a program that determines whether one positive integer is a multiple of another.
|
||||
///
|
||||
/// # Description
|
||||
///
|
||||
/// Checks if a positive integer `x` is a multiple of another positive integer `y`.
|
||||
///
|
||||
/// A multiple of `y` is a positive integer `x` where `x` is evenly divisible by `y` (i.e., `x % y == 0`).
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `x` - The positive integer to determine whether it is a multiple of `y` or not.
|
||||
/// * `y` - The positive integer for which the multiple check of `x` is performed.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `true` if `x` is a multiple of `y`, `false` otherwise.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use ladderz::pre_algebra::unit1::is_multiple;
|
||||
/// use ladderz::pre_algebra::is_multiple;
|
||||
///
|
||||
/// fn main() {
|
||||
/// assert!(is_multiple(16, 2)); // 16 is a multiple of 2
|
||||
|
|
@ -477,29 +330,14 @@
|
|||
|
||||
<span class="doccomment">/// Finds all the multiples of a positive integer `n` up to and including `end` (in the range [n, end]).
|
||||
///
|
||||
/// # Challenge
|
||||
///
|
||||
/// Write a program that finds all the multiples of a positive integer `n` in a given range.
|
||||
///
|
||||
/// # Description
|
||||
///
|
||||
/// Returns a HashSet containing all the multiples of a positive integer `n` in the range [n, end].
|
||||
/// Returns a `HashSet<u32>` containing all the multiples of a positive integer `n` in the range [n, end].
|
||||
///
|
||||
/// A multiple of `n` is a positive integer `num` where `num` is evenly divisible by `n` (i.e., `num % n == 0`).
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `n` - The positive integer for which multiples are to be found.
|
||||
/// * `end` - The upper limit of the range for finding multiples.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A HashSet containing all the multiples of `n` in the range [n, end].
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use ladderz::pre_algebra::unit1::get_multiples_in_range;
|
||||
/// use ladderz::pre_algebra::get_multiples_in_range;
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// fn main() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue