day 23 part 2
This commit is contained in:
13
src/day23.rs
13
src/day23.rs
@@ -17,6 +17,7 @@ fn run(mem: Vec<&str>, a: i32) -> usize {
|
||||
let mut ip: i32 = 0;
|
||||
|
||||
while let Some(line) = mem.get(ip as usize) {
|
||||
// println!("{a} {b} - {line}");
|
||||
let (lhs, rhs) = line.split_once(" ").unwrap();
|
||||
match lhs {
|
||||
"hlf" => {
|
||||
@@ -80,5 +81,15 @@ fn parse_offset(input: &str) -> i32 {
|
||||
|
||||
#[aoc(day23, part2)]
|
||||
fn part2(_: &Input) -> usize {
|
||||
0
|
||||
let mut a: u64 = 113383;
|
||||
let mut b = 0;
|
||||
while a != 1 {
|
||||
a = a * 3 + 1;
|
||||
b += 1;
|
||||
while a % 2 == 0 {
|
||||
a /= 2;
|
||||
b += 1;
|
||||
}
|
||||
}
|
||||
b
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user