from collections import * from itertools import * from functools import * from heapq import * import sys,math N,p = input().split() N = int(N) p = float(p) class prime_factorize(): def __init__(self,M=10**6): self.sieve = [-1]*(M+1) self.sieve[1] = 1 self.p = [False]*(M+1) self.mu = [1]*(M+1) for i in range(2,M+1): if self.sieve[i] == -1: self.p[i] = True i2 = i**2 for j in range(i2,M+1,i2): self.mu[j] = 0 for j in range(i,M+1,i): self.sieve[j] = i self.mu[j] *= -1 def factors(self,x): tmp = [] while self.sieve[x] != x: tmp.append(self.sieve[x]) x //= self.sieve[x] tmp.append(self.sieve[x]) return tmp def is_prime(self,x): return self.p[x] def mobius(self,x): return self.mu[x] pf = prime_factorize() ans = 0 mem = defaultdict(lambda:-1) mem[0] = 1 def f(x): if mem[x]!=-1: return mem[x] mem[x] = f(x-1)*(1-p) return mem[x] for i in range(2,N+1): C = Counter(pf.factors(i)) t = 1 for v in C.values(): t *= (1+v) # print(i,t) ans += f(t-2) print(ans)