mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

science_man_88 2010-11-28 00:39

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 2010-11-28 00:52

[QUOTE= Pi][COLOR="lime"]cs(a,x,m)=for(n=a,x,print(m*fp(n)+1)[/COLOR]);[COLOR="lime"]if(isprime(m*fp(n)+1),break)[/COLOR][/QUOTE]
[QUOTE=science_man_88;238970][CODE][COLOR="Lime"]cs(a,x,m)=for(n=a,x,print(m*fp(n)+1)[/COLOR];[COLOR="lime"]if(isprime(m*fp(n)+1),break([COLOR="Black"]1[/COLOR]))[/COLOR])[/CODE][/QUOTE]

figure it out...

3.14159 2010-11-28 01:02

[QUOTE=science_man_88;238976]figure it out...[/QUOTE]

I already did; I was merely inattentive. Don't flatter yourself.

science_man_88 2010-11-28 01:19

[QUOTE=3.14159;238978]I already did; I was merely inattentive. Don't flatter yourself.[/QUOTE]

Sorry I just see no reason for me to correct you if I don't,as you have more ability than me.

3.14159 2010-11-28 02:12

[QUOTE=science_man_88;238979]Sorry I just see no reason for me to correct you if I don't,as you have more ability than me.[/QUOTE]

I have an idea, in order to search for those k's with no primes. I'll do an amateur sieve, but it keeps [B]primes[/B] out instead.

CRGreathouse 2010-11-28 04:04

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:
[url]http://rosettacode.org/wiki/Category:PARI/GP[/url]

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 [url=http://rosettacode.org/wiki/Roots_of_a_function#PARI.2FGP]root finding[/url].

* 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?).

science_man_88 2010-11-28 12:41

[QUOTE=CRGreathouse;238992]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:
[url]http://rosettacode.org/wiki/Category:PARI/GP[/url]

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 [url=http://rosettacode.org/wiki/Roots_of_a_function#PARI.2FGP]root finding[/url].

* 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?).[/QUOTE]

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 [URL="http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_PARI/GP"]here[/URL] and some of these are talked of in number freak maybe that can help lol.

science_man_88 2010-11-28 12:51

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

science_man_88 2010-11-28 13:03

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 2010-11-28 13:22

okay a little trouble:

[CODE] stack= [0]

push(n)=concat(stack,n)

pop(n)=stack[#stack]=n;[/CODE]

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 2010-11-28 14:39

Found around the push error.

Now if only I can get pop to work.


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

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