Skip to content

Instantly share code, notes, and snippets.

View liquidhelium's full-sized avatar
🛌
Embedded developer.

液氦 liquidhelium

🛌
Embedded developer.
  • Unknown
View GitHub Profile
@liquidhelium
liquidhelium / fivesums.rs
Created December 26, 2025 14:56
Write given number as sums of five fifth powers
use rayon::prelude::*;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::{Duration, Instant};
use std::io::{self, Write};
/// Finds sets of 3 numbers within `[range_start, range_end]`
/// such that the sum of their 5th powers equals `target_sum`.
/// Complexity: O(N^2 log N) time, O(N^2) space (compact)
// 定义零:作为自然数的起点
struct Zero;
// 定义后继:Succ<N> 表示自然数 N 的后继(即 N + 1)
struct Succ<N>(N);
// 为自然数定义特性
trait Natural {
// 获取数值(运行时)
fn value() -> usize;