using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); int kamoCount = inpt[0]; int maxX = inpt[1]; int[] primeList = this.GetPrimeNumbers(maxX); long ans = 0; for (int i = 0; i < primeList.Length; i++) { int prime = primeList[i]; long pos = ((long)kamoCount - 1) * prime; if (pos > maxX) { break; } ans += (maxX - (pos) + 1); } Console.WriteLine(ans); } private int[] GetPrimeNumbers(int max) { bool[] flag = new bool[max + 1]; List ans = new List(); for (int i = 2; i < flag.Length; i++) { if (!flag[i]) { ans.Add(i); for (int j = 1; j <= max / i; j++) { flag[i * j] = true; } } } return ans.ToArray(); } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 8 964853 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }