Talk:Zumkeller numbers: Difference between revisions

From Rosetta Code
Content added Content deleted
 
Line 4: Line 4:
if (n % 2 || d.size() >= 24)
if (n % 2 || d.size() >= 24)
return true;</pre>
return true;</pre>
99504 has 28 divisors and is not a zumkeller number.[[user horsth|Horsth]] 06:56, 9 May 2021 (UTC)
99504 has 28 divisors and is not a zumkeller number.<BR>
Testet with GO version:
<lang go>func main() {
fmt.Println("The first 220 Zumkeller numbers are:")
for i, count := 99500, 0; count < 5; i++ {
if isZumkeller(i) {
fmt.Printf("%3d ", i)</lang>
<pre>
99500 99510 99512 99516 99520 </pre>
Testet with cpp version:
<lang cpp>
int main() {
cout << "First 220 Zumkeller numbers:" << endl;
vector<uint> zumz;
for (uint n = 99500; zumz.size() < 5; n++)
if (isZum(n))
zumz.push_back(n);
cout << zumz << endl << endl;
...
// if we get here and n is odd or n has at least 24 divisors it's a zum!
if (n % 2 || d.size() >= 29)
return true;</lang>
<pre>
99500 99504 99510 99512 99516 </pre>


[[user horsth|Horsth]] 06:56, 9 May 2021 (UTC)

Revision as of 07:14, 9 May 2021

Why this limitation in c++

    // if we get here and n is odd or n has at least 24 divisors it's a zum!
    if (n % 2 || d.size() >= 24)
        return true;

99504 has 28 divisors and is not a zumkeller number.
Testet with GO version: <lang go>func main() {

   fmt.Println("The first 220 Zumkeller numbers are:")
   for i, count := 99500, 0; count < 5; i++ {
       if isZumkeller(i) {
           fmt.Printf("%3d ", i)</lang>
99500 99510 99512 99516 99520 

Testet with cpp version: <lang cpp> int main() {

   cout << "First 220 Zumkeller numbers:" << endl;
   vector<uint> zumz;
   for (uint n = 99500; zumz.size() < 5; n++)
       if (isZum(n))
           zumz.push_back(n);
   cout << zumz << endl << endl;

...

   // if we get here and n is odd or n has at least 24 divisors it's a zum!
   if (n % 2 || d.size() >= 29)
       return true;</lang>
     99500      99504      99510      99512      99516 


Horsth 06:56, 9 May 2021 (UTC)