+2
-3
2025/2/src/main.rs
+2
-3
2025/2/src/main.rs
···
24
24
let len = num_string.len();
25
25
26
26
// we'll only check up to the half way mark since after that it cant possibly repeat
27
-
for i in 0..=(len / 2) {
27
+
for i in 0..=(len / 2 - 1) {
28
28
let substring_len = i + 1;
29
-
// i kinda wanted to get rid of the second check but cant bc of nums with 2 digits
30
-
if len % substring_len == 0 && len != substring_len {
29
+
if len % substring_len == 0 {
31
30
if num_string == num_string.get(0..=i).unwrap().repeat(len / substring_len) {
32
31
counter += num;
33
32
continue 'outer;