// Program 62: Möbius Function import java.util.*; class MobiusFunction { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n < 1) { System.out.println("INVALID INPUT"); return; } int temp = n, count = 0; boolean repeated = false; StringBuilder factors = new StringBuilder(); for (int p = 2; p * p <= temp; p++) { int power = 0; while (temp % p == 0) { temp /= p; power++; } if (power > 0) { count++; if (factors.length() > 0) { factors.append(" x "); } for (int j = 0; j < power; j++) { factors.append(p).append(j + 1 < power ? " x " : ""); } if (power > 1) { repeated = true; } } } if (temp > 1) { count++; if (factors.length() > 0) { factors.append(" x "); } factors.append(temp); } if (n == 1) { factors.append("1"); } int result = n == 1 ? 1 : (repeated ? 0 : (count % 2 == 0 ? 1 : -1)); System.out.println(n + " = " + factors); System.out.println("NUMBER OF DISTINCT PRIME FACTORS = " + count); if (repeated) { System.out.println("DUPLICATE PRIME FACTORS"); } else if (n == 1) { System.out.println("NO PRIME FACTORS"); } System.out.println("M(" + n + ") = " + result); } }