mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-11-28, 00:39   #1739
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

Still baffled by the error in your first code Pi ? If so I can tell you it's simple, in fact I over thought it.
science_man_88 is offline   Reply With Quote
Old 2010-11-28, 00:52   #1740
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

838410 Posts
Default

Quote:
Originally Posted by Pi
cs(a,x,m)=for(n=a,x,print(m*fp(n)+1));if(isprime(m*fp(n)+1),break)
Quote:
Originally Posted by science_man_88 View Post
Code:
cs(a,x,m)=for(n=a,x,print(m*fp(n)+1);if(isprime(m*fp(n)+1),break(1)))
figure it out...

Last fiddled with by science_man_88 on 2010-11-28 at 00:57
science_man_88 is offline   Reply With Quote
Old 2010-11-28, 01:02   #1741
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

32208 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
figure it out...
I already did; I was merely inattentive. Don't flatter yourself.

Last fiddled with by 3.14159 on 2010-11-28 at 01:15
3.14159 is offline   Reply With Quote
Old 2010-11-28, 01:19   #1742
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by 3.14159 View Post
I already did; I was merely inattentive. Don't flatter yourself.
Sorry I just see no reason for me to correct you if I don't,as you have more ability than me.

Last fiddled with by science_man_88 on 2010-11-28 at 01:20
science_man_88 is offline   Reply With Quote
Old 2010-11-28, 02:12   #1743
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Sorry I just see no reason for me to correct you if I don't,as you have more ability than me.
I have an idea, in order to search for those k's with no primes. I'll do an amateur sieve, but it keeps primes out instead.

Last fiddled with by 3.14159 on 2010-11-28 at 02:13
3.14159 is offline   Reply With Quote
Old 2010-11-28, 04:04   #1744
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Back to the original topic for a moment:

I've been doing some work over at Rosetta Code, adding examples of simple tasks in Pari/GP. Here's the link:
http://rosettacode.org/wiki/Category:PARI/GP

You may find this useful if you're trying to do something simple in Pari that seems like it should be easy, but you just don't know the commands or can't think of a good way to do it. I found it very instructive to write these examples; you may be able to either learn from it or teach me (feel free to post here, PM me, or simply change one of the RC entries).

I have 132 tasks solved at the moment,* ranging from simple ones like language basics (loops, arithmetic) and primality by trial division to complicated ones like root finding.

* Actually, I imagine that a few of those were written by others, but I certainly wrote the bulk. You can look at the edit history if you're interested in authorship (but why would you be?).

Last fiddled with by CRGreathouse on 2010-11-28 at 04:09
CRGreathouse is offline   Reply With Quote
Old 2010-11-28, 12:41   #1745
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Back to the original topic for a moment:

I've been doing some work over at Rosetta Code, adding examples of simple tasks in Pari/GP. Here's the link:
http://rosettacode.org/wiki/Category:PARI/GP

You may find this useful if you're trying to do something simple in Pari that seems like it should be easy, but you just don't know the commands or can't think of a good way to do it. I found it very instructive to write these examples; you may be able to either learn from it or teach me (feel free to post here, PM me, or simply change one of the RC entries).

I have 132 tasks solved at the moment,* ranging from simple ones like language basics (loops, arithmetic) and primality by trial division to complicated ones like root finding.

* Actually, I imagine that a few of those were written by others, but I certainly wrote the bulk. You can look at the edit history if you're interested in authorship (but why would you be?).
thanks maybe I can use my book on system commands of ms-dos
that I own to help system() is a function just can't remember the coding for some of the things on here and some of these are talked of in number freak maybe that can help lol.
science_man_88 is offline   Reply With Quote
Old 2010-11-28, 12:51   #1746
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

Also stack is on that list. I've actually wanted to for a long time try to make pari resemble asm lol.

Last fiddled with by science_man_88 on 2010-11-28 at 12:51
science_man_88 is offline   Reply With Quote
Old 2010-11-28, 13:03   #1747
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Stack needs:

vector to act as placeholders;

concat() that acts like push and throws errors if something like concat(data,c) in the mix;

pop instruction to take the last in as the first out. In other words a variable like the stack pointer in asm to point at the data to be popped off.
science_man_88 is offline   Reply With Quote
Old 2010-11-28, 13:22   #1748
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

okay a little trouble:

Code:
 stack= [0]

push(n)=concat(stack,n)

pop(n)=stack[#stack]=n;
push only does it's job with concat() the first time I use it.

pop I coded wrong and even correctly coded it doesn't work.
science_man_88 is offline   Reply With Quote
Old 2010-11-28, 14:39   #1749
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Found around the push error.

Now if only I can get pop to work.
science_man_88 is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I sometimes see all the <> formatting commands when I quote or edit? cheesehead Forum Feedback 3 2013-05-25 12:56
Passing commands to PARI on Windows James Heinrich Software 2 2012-05-13 19:19
Ubiquity commands Mini-Geek Aliquot Sequences 1 2009-09-22 19:33
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22
Are these commands correct? jasong Linux 2 2007-10-18 23:40

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


Fri Aug 6 23:04:38 UTC 2021 up 14 days, 17:33, 1 user, load averages: 3.50, 3.80, 3.90

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.