<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Binary Search on Adnatull's Blog</title><link>https://adnatull.github.io/tags/binary-search/</link><description>Recent content in Binary Search on Adnatull's Blog</description><image><title>Adnatull's Blog</title><url>https://adnatull.github.io/images/logo.jpg</url><link>https://adnatull.github.io/images/logo.jpg</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 29 Jan 2018 13:23:00 +0000</lastBuildDate><atom:link href="https://adnatull.github.io/tags/binary-search/index.xml" rel="self" type="application/rss+xml"/><item><title>UVA 11876 - N + NOD (N)</title><link>https://adnatull.github.io/dev/2018/01/29/uva-11876-n--nod-n/</link><pubDate>Mon, 29 Jan 2018 13:23:00 +0000</pubDate><guid>https://adnatull.github.io/dev/2018/01/29/uva-11876-n--nod-n/</guid><description>&lt;h3 id="description"&gt;Description:&lt;/h3&gt;
&lt;p&gt;For a number N, first have to calculate N-1+divisors(N-1) &amp;amp; store it in array (e.g. arr[i]=arr[i-1]+divisors(arr[i-1])).
Make a sequence from 1 to until arr[i] becomes greater than 1000000. Then you will be given two numbers A &amp;amp; B, and you will have to find the number of integers from the above sequence which lies within the range [A,B].&lt;/p&gt;
&lt;p&gt;Hints = No critical case. Easy problem.&lt;/p&gt;
&lt;!-- more --&gt;
&lt;h3 id="algorithm"&gt;Algorithm:&lt;/h3&gt;
&lt;p&gt;Step 1:
First find the prime numbers from 1 to 1000000 and store them in an array (was not sure about the range, thats why I calculated till 1000000) .
Step 2:
Calculate number of divisors for each numbers from 1 to 1000000 and store divisors in each array. (e.g. divisors of 6 are 1,2,3,6. Total 4 divisors. So divisor[6]=4. )
Step 3: To find the divisors of each number, I took help of prime numbers. There is a good tutorial in lightoj.com to find divisors using primes. Link is give below:
&lt;a href="http://lightoj.com/article_show.php?article=1003"&gt;http://lightoj.com/article_show.php?article=1003&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>