using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yuki_407 { class Program { static void Main(string[] args) { var a = scan(); int max = a[1]/(a[0]-1); var p = new List(); if (max>1) { eratos(p, max); } long ans = 0; foreach (var i in p) { int m = a[1] - i*(a[0]-1) + 1; if (m<=0) { break; } else { ans += m; } } Console.WriteLine(ans); } //2~nまでの素数のリスト(n>=2) static void eratos(List Prime,int n) { var a = new bool[n+1]; a[0] =a[1]= true; int i; for (i = 2; i*i<=n; i++) { if (!a[i]) { Prime.Add(i); int j = i << 1; while (j <= n) { a[j] = true; j = j + i; } } } for (; i <=n ; i++)if(!a[i])Prime.Add(i); } static int[] scan() { return Array.ConvertAll (Console.ReadLine().Split(' '), int.Parse); } } }