Talk:Zumkeller numbers: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Why this limitation in c++: first occurrences of non Zumkeller numbers with many divisors like 58896 with 30 divisors)
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.<BR>
99504 has 30 divisors and is not a zumkeller number.<BR>
Testet with GO version:
Testet with GO version:
<lang go>func main() {
<lang go>func main() {
Line 29: Line 29:
99500 99504 99510 99512 99516 </pre>
99500 99504 99510 99512 99516 </pre>


Checked the first 100,000 zumkeller numbers.<BR>

First occurence of Non-Zumkeller number with count of divisors
<pre>
Div
count number
12 738
16 7544
18 3492
20 56816
24 14184
30 58896
36 236448</pre>
[[user horsth|Horsth]] 06:56, 9 May 2021 (UTC)
[[user horsth|Horsth]] 06:56, 9 May 2021 (UTC)

Revision as of 08:45, 10 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 30 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 

Checked the first 100,000 zumkeller numbers.
First occurence of Non-Zumkeller number with count of divisors

Div 
count    number
  12       738
  16      7544
  18      3492
  20     56816
  24     14184
  30     58896
  36    236448

Horsth 06:56, 9 May 2021 (UTC)