mersenneforum.org Need help pari gp
 Register FAQ Search Today's Posts Mark Forums Read

 2020-04-24, 19:54 #1 User133   Apr 2020 22·5 Posts Need help pari gp Hello, I really need help solving this problem in Pari / gp "Among the numbers 3 (10 ^ 8) ≤n≤4 (10 ^ 8), find the number with the largest sum of divisors. If there are several such numbers, find all"
 2020-04-24, 19:59 #2 Uncwilly 6809 > 6502     """"""""""""""""""" Aug 2003 101×103 Posts 23·1,361 Posts Post moved to Homework Help. This is a homework issue. What have you done so far?
 2020-04-25, 07:13 #3 User133   Apr 2020 248 Posts Need help pari gp hello, I need help with the task for Pari / gp "Among the numbers 3 (10 ^ 8) ≤n≤4 (10 ^ 8), find the number that has the greatest sum of divisors. If there are several such numbers, find all"
 2020-04-25, 07:28 #4 axn     Jun 2003 124748 Posts Use numdiv function
 2020-04-25, 07:54 #5 User133   Apr 2020 22×5 Posts my problem is that I do not know this program. I have not been able to collect the task in this program for several days Last fiddled with by User133 on 2020-04-25 at 07:54
 2020-04-25, 08:10 #6 User133   Apr 2020 1416 Posts . Last fiddled with by User133 on 2020-04-25 at 08:11
2020-04-25, 08:13   #7
User133

Apr 2020

22·5 Posts

Quote:
 Originally Posted by axn Use numdiv function
I don’t even know the structure of building, I work for the first time in my life. You can more details please

 2020-04-25, 08:13 #8 LaurV Romulan Interpreter     "name field" Jun 2011 Thailand 282116 Posts This is for homework thread. It may be moved there later, as it has nothing to do with num theory. Anyhow, we are trying to help. 1. Do you need just to know the answer? If so, you can easily find it on the web. 397837440, with the sum 1974067200 2. Do you need to learn pari functions? Or to use pari predefined functions to get the answer? If so, look at help for vecsum() and divisors() functions. s=0; for(n=3*10^8,4*10^8,z=vecsum(divisors(n)); if(s30 years ago, we had to sort a list (in Pascal, or C), and learn different ways to sort it, in the process (bubblesort, flagsort, quicksort, etc). One colleague presented program with one line of code only, he was calling the "sort" function in dBase (at the time) and was very upset when the professor, laughing his lungs out, marked him "failed". He even didn't understand that the requirement was not to sort a stupid, 20 items list, which could be easily sorted by pencil, but to learn the algorithms. True story! P.S. at axn: numdiv ??? gotcha! Last fiddled with by LaurV on 2020-04-25 at 08:22
 2020-04-25, 08:17 #9 User133   Apr 2020 1416 Posts the teacher gave it and didn’t even explain anything. We asked him to help and explain, but he refuses. I quickly solved the problem itself, but I can’t build it in pari (I’ve been trying to figure out the program myself for 3 days but can’t do anything) Last fiddled with by LaurV on 2020-04-25 at 08:24
 2020-04-25, 08:36 #10 LaurV Romulan Interpreter     "name field" Jun 2011 Thailand 10,273 Posts Ok, first welcome to the forum. It is a good netiquette not to quote the full precedent post (it overloads the forum, people know what you reply to, unless it is very specific, and you need to quote some paragraph, or you reply to older posts), and also not to reply immediately in 10 seconds after the post was done (this gives me time to edit my silly mistakes out of the text, and also avoids "flame wars", sometimes, if you wait 10 minutes before replying, and think to the issues, you find a better way to reply, or can solve the problem by yourself already). Now, the thread stays here, as it seems is more about Pari/GP than about homework. So, what did you do with pari, up to now? 1. Could you download it from its home site? (to be sure you don't have some trojan pretending to be pari) 2. Could you install it? (as simple as running the setup) 3. Did it install a "doc" folder, where the "user.pdf" or such, is copied? 4. Did you have a look at it? (RTFM) 5. Can you execute simple functions that return a result? (like the ones I posted) 6. Are you trying to do the algorithm about the sum of the divisors by yourself? (if so, then you may have a mistake inside, which results in an endless loop or so, go again through the algorithm and put some "print" to output intermediary values, or use "break" and debug it. There is no way that an algorithm which is correct and well implemented, will take more than 3-5 minutes to solve this problem. The piece of code I posted above (in spoilers) needs 5 minutes and 11 seconds in my (very slow) laptop which I currently work at. 7. What do you mean "build"? Are you trying to use libpari and "build" some C program with the method, or what? If so, try it in GP first to see if its working, THEN move to libpari to speed up or so. Start small. Please describe to us a little what you are trying to do. We have here some guys who can REALLY help you with Pari, with the math side, with the programming side, etc. Last fiddled with by LaurV on 2020-04-25 at 08:47
2020-04-25, 08:40   #11
User133

Apr 2020

22·5 Posts

Quote:
 Originally Posted by Uncwilly Post moved to Homework Help. This is a homework issue. What have you done so far?
{
n0=0; m0=1; p0=0;
for(n=40,50,
if(vecsum(divisors(n))>m0, m0=vecsum(divisors(n));n0=n);
if(vecsum(divisors(n))==m0, p0+1);
print("summa_del_chisla(", n, ")=", vecsum(divisors(n)), "; MAX summa_del_chisla(",n0, ")=", m0, " povtorov- ", p0 );
)
}

 Similar Threads Thread Thread Starter Forum Replies Last Post paul0 Programming 2 2015-11-17 13:04 skan Miscellaneous Math 0 2012-12-16 00:13 devarajkandadai Programming 21 2012-08-31 18:08 CRGreathouse Software 2 2009-03-13 04:22

All times are UTC. The time now is 04:11.

Sat Jan 28 04:11:31 UTC 2023 up 163 days, 1:40, 0 users, load averages: 1.34, 1.19, 1.07