<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 N)</td></tr>
char </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d4/dbd/problem__23_2sol2_8c.html#a34f4ad85151e3a43368ae67f42347f56">is_abundant</a> (unsigned long N)</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 N)</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 N)</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="l00033"></a><spanclass="lineno"> 33</span> <spanclass="keywordtype">unsigned</span><spanclass="keywordtype">long</span> sum = 1;</div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"> 34</span> <spanclass="keywordtype">char</span> ret = 0;</div>
<divclass="line"><aname="l00036"></a><spanclass="lineno"> 36</span> <spanclass="keywordflow">for</span> (<spanclass="keywordtype">unsigned</span><spanclass="keywordtype">long</span> i = 2; i * i <= N; i++)</div>
<divclass="line"><aname="l00090"></a><spanclass="lineno"> 90</span> <spanclass="comment"> * i + j = N where both i and j should be abundant</span></div>
<divclass="line"><aname="l00091"></a><spanclass="lineno"> 91</span> <spanclass="comment"> * hence we can simply check for j = N - i as we loop through i</span></div>
<divclass="line"><aname="l00093"></a><spanclass="lineno"> 93</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 <= (N >> 1);</div>
<divclass="line"><aname="l00094"></a><spanclass="lineno"> 94</span>  i = <aclass="code"href="../../d4/dbd/problem__23_2sol2_8c.html#ac5d600bf3077f4188afc4c5cd2c40eaf">get_next_abundant</a>(i))</div>
<divclass="line"><aname="l00099"></a><spanclass="lineno"> 99</span>  printf(<spanclass="stringliteral">"\t%4lu + %4lu = %4lu\n"</span>, i, N - i, N);</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__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>
<liclass="footer">Generated by <ahref="http://www.doxygen.org/index.html"><imgclass="footer"src="../../doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.8.20 </li>