For this Question: Phoebe is a big GCD fan. Being bored, she starts counting number of pairs of integers (A, B) such that following conditions are satisfied:
<li> GCD(A, B) = X (As X is Phoebe's favourite integer)
<li> A <= B <= L
As Phoebe's performance is coming up, she needs your help to find the number of such pairs possible.

Note: GCD refers to the <a href="https://en.wikipedia.org/wiki/Greatest_common_divisor">Greatest common divisor</a>.Input contains two integers L and X.

Constraints:
1 <= L, X <= 1000000000Print a single integer denoting number of pairs possible.Sample Input
5 2

Sample Output
2

Explanation: Pairs satisfying all conditions are: (2, 2), (2, 4)

Sample Input
5 3

Sample Output
1

Explanation: Pairs satisfying all conditions are: (3, 3), I have written this Solution Code: import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

class Main {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{

		out.println(sumTotient(ni()/ni()));
	}

	public static int[] enumTotientByLpf(int n, int[] lpf)
	{
		int[] ret = new int[n+1];
		ret[1] = 1;
		for(int i = 2;i <= n;i++){
			int j = i/lpf[i];
			if(lpf[j] != lpf[i]){
				ret[i] = ret[j] * (lpf[i]-1);
			}else{
				ret[i] = ret[j] * lpf[i];
			}
		}
		return ret;
	}

	public static int[] enumLowestPrimeFactors(int n)
	{
		int tot = 0;
		int[] lpf = new int[n+1];
		int u = n+32;
		double lu = Math.log(u);
		int[] primes = new int[(int)(u/lu+u/lu/lu*1.5)];
		for(int i = 2;i <= n;i++)lpf[i] = i;
		for(int p = 2;p <= n;p++){
			if(lpf[p] == p)primes[tot++] = p;
			int tmp;
			for(int i = 0;i < tot && primes[i] <= lpf[p] && (tmp = primes[i]*p) <= n;i++){
				lpf[tmp] = primes[i];
			}
		}
		return lpf;
	}


	public static long sumTotient(int n)
	{
		if(n == 0)return 0L;
		if(n == 1)return 1L;

		int s = (int)Math.sqrt(n);
		long[] cacheu = new long[n/s];
		long[] cachel = new long[s+1];




		int X = (int)Math.pow(n, 0.66);
		int[] lpf = enumLowestPrimeFactors(X);
		int[] tot = enumTotientByLpf(X, lpf);
		long sum = 0;
		int p = cacheu.length-1;
		for(int i = 1;i <= X;i++){
			sum += tot[i];
			if(i <= s){
				cachel[i] = sum;
			}else if(p > 0 && i == n/p){
				cacheu[p] = sum;
				p--;
			}
		}


		for(int i = p;i >= 1;i--){
			int x = n/i;
			long all = (long)x*(x+1)/2;
			int ls = (int)Math.sqrt(x);
			for(int j = 2;x/j > ls;j++){
				long lval = i*j < cacheu.length ? cacheu[i*j] : cachel[x/j];
				all -= lval;
			}
			for(int v = ls;v >= 1;v--){
				long w = x/v-x/(v+1);
				all -= cachel[v]*w;
			}
			cacheu[(int)i] = all;
		}
		return cacheu[1];
	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new Main().run(); }

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?