mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-08-19, 18:21   #683
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

scratch f we can just use v=f to redefine it back to v after.
science_man_88 is offline   Reply With Quote
Old 2010-08-19, 18:22   #684
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
CRG I got my code to work to find primes and fill a vector of 0's with them I'm thinking of how to make a function VecApp(v,x,f) that takes one vector(v) into another vector(f) with 1 extra element which is appended with value x maybe that will make it easier on me. I think this would need to say something like f[i] = v[i] f[i]+1 = x but I'm without reading them all I have no idea how to get i not to go over the amount of indexes of v.
Code:
concat([1,2,3],10)
CRGreathouse is offline   Reply With Quote
Old 2010-08-19, 18:23   #685
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

I'm an idiot thanks.
science_man_88 is offline   Reply With Quote
Old 2010-08-19, 18:25   #686
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Just look at my code for how to use the vector!
my(v=vectorsmall(sz, i, 1))?

What is supposed to be the substitution here?
3.14159 is offline   Reply With Quote
Old 2010-08-19, 18:26   #687
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

10111010110112 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
I'm an idiot thanks.
You were trying to write a function that already existed. That's pretty common. I wrote my own version of eint1, at the very least -- but probably others, too.
CRGreathouse is offline   Reply With Quote
Old 2010-08-19, 18:31   #688
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24×3×5×7 Posts
Default

A 1 in 1065 chance:

I entered a(65), which is nextprime(random(10^65)). The result: 2.
3.14159 is offline   Reply With Quote
Old 2010-08-19, 18:35   #689
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

135338 Posts
Default

Well, 3 in 10^65 anyway. Wow.
CRGreathouse is offline   Reply With Quote
Old 2010-08-19, 18:56   #690
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
Well, 3 in 10^65 anyway. Wow.
It was in fact, too good to be true. It turned out PARI was messed for a while.

I entered a(7) and got 2, 6 times in a row. I tried a(8) through a(12), and got 2, about 20 times on end.

This would normally happen only about 1 in ≈10163 times. I'm going with PARI being a bit buggy. Or did I have a supreme stroke of luck and just defy odds of 1 in 10163?

Also: The lottery should be changed to guessing 10 random numbers between 1 and 1015.

(To ensure that nobody wins, )

Last fiddled with by 3.14159 on 2010-08-19 at 19:07
3.14159 is offline   Reply With Quote
Old 2010-08-19, 19:10   #691
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

You may have inadvertently overwritten a. Try ?a to see the current definition.
CRGreathouse is offline   Reply With Quote
Old 2010-08-19, 19:15   #692
3.14159
 
3.14159's Avatar
 
May 2010
Prime hunting commission.

24·3·5·7 Posts
Default

Quote:
Originally Posted by CRGreathouse
You may have inadvertently overwritten a. Try ?a to see the current definition.
Nope. I changed nothing. It was either incredible luck or the computer fucking up.
3.14159 is offline   Reply With Quote
Old 2010-08-19, 19:16   #693
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Code:
(15:27) gp > v=vector(1,n,0);a=1;for(x=1,10000,if(isprime(x),v[a]=x;concat(v[],0);a=a+1))
  ***   unused characters: v=vector(1,n,0);a=1;for(x=1,10000,if(is
                                              ^--------------------
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:05.


Fri Aug 6 23:05:08 UTC 2021 up 14 days, 17:34, 1 user, load averages: 3.39, 3.74, 3.87

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.