![]() |
I did the correction in mentioned post, re gender (his->its) in four places. FWIW the things work the same in Romanian, we have a neutral gender, but we don't have an "it" for it. Neuter things are "he" when singular. With plurals, things get more complicate, we have a "feminine-they" and a "masculine-they". For neuters plurals, "feminine-they" is used. That is why I also make this mistake, calling the dog "he" and the cat "she" when "it" should be used. So, no harm done. Somebody told me that it is not incorrect in English to use he/she when you want to personify things. So, for me, numbers are important persons! Especially when prime and have millions of digits! :razz:
|
[QUOTE=garambois;574287]Please I am unable to add the correct line of code to write this in bold below in my save file called "power_abundant_exponents" :
[B]30 55440[/B] (base + exponent) As you can see, I only manage to write the exponent i and not the base, because I don't know the equivalent for "base" of "% d" that works for i. I do not know the type of "base". By the way, "% d" does not seem correct to me for the variable i, because it can be very large ! But it seems to work ! [CODE] if (n > partial) { fff = fopen ("power_abundant_exponents", "a"); if (fff == NULL) printf("Impossible to open file !"); else { [B] fprintf (fff, "%d\n",i);[/B] fclose (fff); cout << base.get_str() << "^" << i << " is abundant !" << endl; }; } else { // cout << base.get_str() << "^" << i << " is not abundant." << endl; }[/CODE][/QUOTE] First of all, you're using C IO calls in a C++ program, which is ugly. Use the following code from aliqueit as a syntax guide for ofstream (the exact code is not what you want, but it's a start): [code]void log_msg(string msg, bool timestamp) { ofstream f(cfg.log_file.c_str(), ios::app); if (!f.is_open()) { cout << "WARNING: couldn't open log file for writing!" << endl; return; } if (timestamp) f << get_timestamp() << " "; f << msg; f.close(); } [/code] You'll need to add [c]#include <fstream>[/c] before line 11. To print the base object (which is a GMP type) as a string, call its get_str() method and pass it where a string is expected. Edit: [c]i[/c] is a 32-bit signed int that can go up to more than 2e9, so it should be more than enough. |
1 Attachment(s)
[QUOTE=garambois;574287]Please I am unable to add the correct line of code to write this in bold below in my save file called "power_abundant_exponents" :
[B]30 55440[/B] (base + exponent) As you can see, I only manage to write the exponent i and not the base, because I don't know the equivalent for "base" of "% d" that works for i. I do not know the type of "base". By the way, "% d" does not seem correct to me for the variable i, because it can be very large ! But it seems to work ! [CODE] if (n > partial) { fff = fopen ("power_abundant_exponents", "a"); if (fff == NULL) printf("Impossible to open file !"); else { [B] fprintf (fff, "%d\n",i);[/B] fclose (fff); cout << base.get_str() << "^" << i << " is abundant !" << endl; }; } else { // cout << base.get_str() << "^" << i << " is not abundant." << endl; }[/CODE][/QUOTE] [QUOTE=Happy5214;574294]First of all, you're using C IO calls in a C++ program, which is ugly.[/QUOTE] I think this attached version does what you're looking for. I made the slight change of exiting out if the file can't be opened, as it doesn't really make sense to continue if it can't log any of the results. Edit: There's a slight typo from your request in that it prints a caret ("^") instead of a space to the log. That's a copy-paste error from the line below that's easy to fix. |
[QUOTE=Happy5214;574296]I think this attached version does what you're looking for. I made the slight change of exiting out if the file can't be opened, as it doesn't really make sense to continue if it can't log any of the results.
Edit: There's a slight typo from your request in that it prints a caret ("^") instead of a space to the log. That's a copy-paste error from the line below that's easy to fix.[/QUOTE] Thank you very much, this is exactly what I need ! Now, I will be able to run the calculations for bases 3, 5 and 7. |
[QUOTE=LaurV;574289]I did the correction in mentioned post, re gender (his->its) in four places. FWIW the things work the same in Romanian, we have a neutral gender, but we don't have an "it" for it. Neuter things are "he" when singular. With plurals, things get more complicate, we have a "feminine-they" and a "masculine-they". For neuters plurals, "feminine-they" is used. That is why I also make this mistake, calling the dog "he" and the cat "she" when "it" should be used. So, no harm done. Somebody told me that it is not incorrect in English to use he/she when you want to personify things. So, for me, numbers are important persons! Especially when prime and have millions of digits! :razz:[/QUOTE]
OK thanks a lot. But unless I'm mistaken, two corrections are missing where the "his" remains ! "And then next is : 80640 = 2^8*3^2*5*7, but this time, [B]his[/B] double and [B]his[/B] triple are not suitable !" :wink: |
[QUOTE=LaurV;574289]That is why I also make this mistake, calling the dog "he" and the cat "she" when "it" should be used. So, no harm done.[/QUOTE]
English speakers also tend to call dogs "he" and cats "she", probably due to the stereotype that men gravitate toward dogs (cf. "man's best friend") and women to cats, though that has nothing to do with grammar. [QUOTE=LaurV;574289]Somebody told me that it is not incorrect in English to use he/she when you want to personify things. So, for me, numbers are important persons! Especially when prime and have millions of digits! :razz:[/QUOTE] Ah, anthropomorphizing a number. That's definitely possible and would make using gendered pronouns grammatically valid, though it'll get you weird looks, and it will probably look to a native speaker more like the translation error we encountered above than the desired effect of a person-like number. But it's a clever way to look at it. :smile: |
1 Attachment(s)
[QUOTE=garambois;574299]Thank you very much, this is exactly what I need !
Now, I will be able to run the calculations for bases 3, 5 and 7.[/QUOTE] I made a slight improvement. This version also logs the factors found, so you can verify that they actually divide the number (using, say, FactorDB) and the abundance (with, say, PARI/GP). I also fixed the caret/space issue. |
[QUOTE=Happy5214;574314]I made a slight improvement. This version also logs the factors found, so you can verify that they actually divide the number (using, say, FactorDB) and the abundance (with, say, PARI/GP). I also fixed the caret/space issue.[/QUOTE]
Thank you very much. I use this latter program. I will let it run for several weeks for bases 3, 5 and 7. :smile: |
Figured I'd get this in before the next page update, but I'm done with the base 24 range between 24^20 and 24^30 and am releasing those. I'm currently working on 24^33 on my desktop (24^31 was terminated in the initial setup run), and after a series of downdriver runs, it's now at 116 digits with a D6. I'll continue to find good downdriver runs to plow through on my laptop. I added more than 3500 terms to 770^43 earlier today, but with nothing to show for it.
|
I tried a few number of exponents on base 7.
So far 1987441237556775=3^5 · 5^2 · 7 · 11 · 13 · 17 · 19 · 23 · 29 · 37 · 41 is lowest odd n I found that s(7^n) is abundant, but with primes <10[SUP]5[/SUP]. |
OK, page updated.
Many thanks to all for your help. [B]Added base :[/B] 62. [B]New bases reserved for yoyo :[/B] 58, 2310, 30030, 510510, 9699690, 82589933. 75 bases in total. Thank you all for checking if everything is in accordance with your requests. |
| All times are UTC. The time now is 21:55. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.