<divclass="center"><iframescrolling="no"frameborder="0"src="../../dc/d23/problem__23_2sol2_8c__incl.svg"width="243"height="127"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<trclass="memitem:a1aca7f530f82b27100262adba9e7556b"><tdclass="memItemLeft"align="right"valign="top">char </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d4/dbd/problem__23_2sol2_8c.html#a1aca7f530f82b27100262adba9e7556b">get_perfect_number</a> (unsigned long <aclass="el"href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
char </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d4/dbd/problem__23_2sol2_8c.html#a34f4ad85151e3a43368ae67f42347f56">is_abundant</a> (unsigned long <aclass="el"href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
<trclass="memdesc:a34f4ad85151e3a43368ae67f42347f56"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Is the given number an abundant number (1) or not (0) <br/></td></tr>
unsigned long </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d4/dbd/problem__23_2sol2_8c.html#ac5d600bf3077f4188afc4c5cd2c40eaf">get_next_abundant</a> (unsigned long <aclass="el"href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
<trclass="memdesc:ac5d600bf3077f4188afc4c5cd2c40eaf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Find the next abundant number after N and not including N. <br/></td></tr>
<trclass="memitem:a3ab61b5a1c4f2288625d160aa0ea8478"><tdclass="memItemLeft"align="right"valign="top">char </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d4/dbd/problem__23_2sol2_8c.html#a3ab61b5a1c4f2288625d160aa0ea8478">is_sum_of_abundant</a> (unsigned long <aclass="el"href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>)</td></tr>
<trclass="memdesc:a3ab61b5a1c4f2288625d160aa0ea8478"><tdclass="mdescLeft"> </td><tdclass="mdescRight">check if a given number can be represented as a sum of two abundant numbers. <ahref="../../d4/dbd/problem__23_2sol2_8c.html#a3ab61b5a1c4f2288625d160aa0ea8478">More...</a><br/></td></tr>
<trclass="memdesc:af920a16d6ef69dd604b283f427892e06"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This is the global array to be used to store a flag to identify if a particular number is abundant (1) or not (0). <ahref="../../d4/dbd/problem__23_2sol2_8c.html#af920a16d6ef69dd604b283f427892e06">More...</a><br/></td></tr>
<divclass="line"><aname="l00035"></a><spanclass="lineno"> 35</span> <spanclass="keywordtype">unsigned</span><spanclass="keywordtype">long</span> sum = 1;</div>
<divclass="line"><aname="l00036"></a><spanclass="lineno"> 36</span> <spanclass="keywordtype">char</span> ret = 0;</div>
<divclass="line"><aname="l00038"></a><spanclass="lineno"> 38</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">unsigned</span><spanclass="keywordtype">long</span> i = 2; i * i <= <aclass="code"href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>; i++)</div>
<divclass="line"><aname="l00088"></a><spanclass="lineno"> 88</span> <spanclass="comment"> * i + j = N where both i and j should be abundant</span></div>
<divclass="line"><aname="l00089"></a><spanclass="lineno"> 89</span> <spanclass="comment"> * hence we can simply check for j = N - i as we loop through i</span></div>
<divclass="line"><aname="l00091"></a><spanclass="lineno"> 91</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">unsigned</span><spanclass="keywordtype">long</span> i = <aclass="code"href="../../d4/dbd/problem__23_2sol2_8c.html#ac5d600bf3077f4188afc4c5cd2c40eaf">get_next_abundant</a>(1); i <= (<aclass="code"href="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a>>> 1);</div>
<divclass="line"><aname="l00092"></a><spanclass="lineno"> 92</span>  i = <aclass="code"href="../../d4/dbd/problem__23_2sol2_8c.html#ac5d600bf3077f4188afc4c5cd2c40eaf">get_next_abundant</a>(i))</div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d4/dbd/problem__23_2sol2_8c_a3ab61b5a1c4f2288625d160aa0ea8478_cgraph.svg"width="474"height="63"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<p>This is the global array to be used to store a flag to identify if a particular number is abundant (1) or not (0). </p>
<p>Using a whole byte to store a binary info would be redundant. We will use each byte to represent 8 numbers by relying on bits. This saves memory required by 1/8 </p>
<divclass="ttc"id="aproblem__13_2sol1_8c_html_a0240ac851181b84ac374872dc5434ee4"><divclass="ttname"><ahref="../../db/d01/problem__13_2sol1_8c.html#a0240ac851181b84ac374872dc5434ee4">N</a></div><divclass="ttdeci">#define N</div><divclass="ttdoc">number of digits of the large number</div><divclass="ttdef"><b>Definition:</b> sol1.c:109</div></div>
<divclass="ttc"id="aproblem__23_2sol2_8c_html_ac5d600bf3077f4188afc4c5cd2c40eaf"><divclass="ttname"><ahref="../../d4/dbd/problem__23_2sol2_8c.html#ac5d600bf3077f4188afc4c5cd2c40eaf">get_next_abundant</a></div><divclass="ttdeci">unsigned long get_next_abundant(unsigned long N)</div><divclass="ttdoc">Find the next abundant number after N and not including N.</div><divclass="ttdef"><b>Definition:</b> sol2.c:70</div></div>
<divclass="ttc"id="aproblem__23_2sol2_8c_html_a34f4ad85151e3a43368ae67f42347f56"><divclass="ttname"><ahref="../../d4/dbd/problem__23_2sol2_8c.html#a34f4ad85151e3a43368ae67f42347f56">is_abundant</a></div><divclass="ttdeci">char is_abundant(unsigned long N)</div><divclass="ttdoc">Is the given number an abundant number (1) or not (0)</div><divclass="ttdef"><b>Definition:</b> sol2.c:59</div></div>