use std::io::*; use std::cmp::*; use std::str::FromStr; #[allow(unused_imports)] fn read() -> T { let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read char") as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().expect("failed to parse token") } fn primes(n:usize) -> usize{ let mut cnt:usize = 0; let root:usize =((n as f64).sqrt()) as usize; for i in 1..root + 1{ match n % i { 0 => cnt += 1, _ => (), } if n / i == i && n % i == 0{ cnt += 1 } } cnt } fn main(){ let x:usize = read(); let mut rec = vec![0;x + 1]; for i in 1..x { rec[i] = primes(i); } let mut ans:Vec> = vec![vec![(0,0);0];x + 1]; let mut mini = 100000000000000000; for i in 1..x{ let fn_s:i64 = (i as i64 - rec[i] as i64) as i64; let fn_b:i64 = ((x - i) as i64 - rec[x - i] as i64) as i64; let tmp = (fn_s - fn_b).abs() as usize; mini = min(mini,tmp); ans[tmp].push((i,x - i)); } for i in &ans[mini] { println!("{} {}", i.0,i.1); } }