mersenneforum.org Aliquot sequences that start on the integer powers n^i
 Register FAQ Search Today's Posts Mark Forums Read

 2021-03-21, 15:29 #1013 LaurV Romulan Interpreter     Jun 2011 Thailand 23×1,193 Posts 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! Last fiddled with by LaurV on 2021-03-21 at 15:30
2021-03-21, 16:27   #1014
Happy5214

"Alexander"
Nov 2008
The Alamo City

2×3×109 Posts

Quote:
 Originally Posted by garambois 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" : 30 55440 (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 { fprintf (fff, "%d\n",i); fclose (fff); cout << base.get_str() << "^" << i << " is abundant !" << endl; }; } else { // cout << base.get_str() << "^" << i << " is not abundant." << endl; }
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();
}
You'll need to add #include <fstream> 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: i is a 32-bit signed int that can go up to more than 2e9, so it should be more than enough.

Last fiddled with by Happy5214 on 2021-03-21 at 16:31

2021-03-21, 17:39   #1015
Happy5214

"Alexander"
Nov 2008
The Alamo City

2·3·109 Posts

Quote:
 Originally Posted by garambois 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" : 30 55440 (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 { fprintf (fff, "%d\n",i); fclose (fff); cout << base.get_str() << "^" << i << " is abundant !" << endl; }; } else { // cout << base.get_str() << "^" << i << " is not abundant." << endl; }
Quote:
 Originally Posted by Happy5214 First of all, you're using C IO calls in a C++ program, which is ugly.
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.
Attached Files
 powerAbundance_2.tar.gz (1.5 KB, 17 views)

Last fiddled with by Happy5214 on 2021-03-21 at 17:43 Reason: Typo found in code

2021-03-21, 18:09   #1016
garambois

"Garambois Jean-Luc"
Oct 2011
France

11438 Posts

Quote:
 Originally Posted by Happy5214 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.

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.

2021-03-21, 18:15   #1017
garambois

"Garambois Jean-Luc"
Oct 2011
France

13×47 Posts

Quote:
 Originally Posted by LaurV 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!

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, his double and his triple are not suitable !"

2021-03-21, 19:49   #1018
Happy5214

"Alexander"
Nov 2008
The Alamo City

2×3×109 Posts

Quote:
 Originally Posted by LaurV 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.
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:
 Originally Posted by LaurV 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!
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.

2021-03-21, 21:14   #1019
Happy5214

"Alexander"
Nov 2008
The Alamo City

2·3·109 Posts

Quote:
 Originally Posted by garambois 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.
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.
Attached Files
 powerAbundance_3.tar.gz (1.6 KB, 17 views)

2021-03-22, 18:03   #1020
garambois

"Garambois Jean-Luc"
Oct 2011
France

10011000112 Posts

Quote:
 Originally Posted by Happy5214 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.

Thank you very much.
I use this latter program.
I will let it run for several weeks for bases 3, 5 and 7.

 2021-03-22, 20:42 #1021 Happy5214     "Alexander" Nov 2008 The Alamo City 2·3·109 Posts 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.
 2021-03-22, 20:44 #1022 warachwe   Aug 2020 2·32 Posts 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 <105.
 2021-03-23, 18:25 #1023 garambois     "Garambois Jean-Luc" Oct 2011 France 13×47 Posts OK, page updated. Many thanks to all for your help. Added base : 62. New bases reserved for yoyo : 58, 2310, 30030, 510510, 9699690, 82589933. 75 bases in total. Thank you all for checking if everything is in accordance with your requests.

 Similar Threads Thread Thread Starter Forum Replies Last Post fivemack FactorDB 46 2021-02-21 10:46 schickel FactorDB 18 2013-06-12 16:09 garambois Aliquot Sequences 34 2012-06-10 21:53 Andi47 FactorDB 21 2011-12-29 21:11 schickel mersennewiki 0 2008-12-30 07:07

All times are UTC. The time now is 00:43.

Sun Jun 20 00:43:14 UTC 2021 up 22 days, 22:30, 0 users, load averages: 1.77, 1.69, 1.76