![]() |
|
|
#254 |
|
Jun 2003
32·5·113 Posts |
|
|
|
|
|
|
#255 |
|
Aug 2006
3·1,993 Posts |
Cute trick, axm. I didn't realize that valuation threaded over vectors, column or otherwise.
Pi, I'd need to see modbm to say. Also, modbmpsp doesn't have matched parentheses -- did you leave something off? Last fiddled with by CRGreathouse on 2010-08-11 at 18:30 |
|
|
|
|
|
#256 | |
|
May 2010
Prime hunting commission.
24×3×5×7 Posts |
Quote:
Code:
modbm(x,n,m)=for(n=x,n,if(isprime(n*p(m)^2+1)&isprime(2*(n*p(m)^2+1)-1),print((n*p(m)^2+1)*(2*(n*p(m)^2+1)-1)))); My normal looping function is normally b(m). Last fiddled with by 3.14159 on 2010-08-11 at 18:41 |
|
|
|
|
|
|
#257 |
|
Aug 2006
3×1,993 Posts |
Well there's your problem. modbmpsp is expecting a return value and modbm doesn't give one, so modbmpsp treats the value as 0.
|
|
|
|
|
|
#258 | |
|
May 2010
Prime hunting commission.
24·3·5·7 Posts |
Quote:
If it were the PRP code that would be the problem: It returns 1, which means there should be no issue. Last fiddled with by 3.14159 on 2010-08-11 at 18:48 |
|
|
|
|
|
|
#259 | |
|
Aug 2006
597910 Posts |
Quote:
Code:
modbmpsp(x,n,m)=if(isPRP(modbm(x,n,m),b=2),print(modbm(x,n,m)) I don't know what you mean by "it" here. |
|
|
|
|
|
|
#260 |
|
May 2010
Prime hunting commission.
69016 Posts |
Ah, I see the issue now.. It merely copies modbm because there's some sort of error in the PRP command.
I have an idea: I will change the snippet to: if(isPRP(modbm(x,n,m),b=2)==1, ... Last fiddled with by 3.14159 on 2010-08-11 at 18:52 |
|
|
|
|
|
#261 |
|
Aug 2006
3·1,993 Posts |
If by "the PRP command" you mean the function isPRP, then no: this problem will occur regardless of how that function is written. If you mean something else, please specify.
|
|
|
|
|
|
#262 | |
|
May 2010
Prime hunting commission.
24·3·5·7 Posts |
Quote:
But it will only return that particular value. I will set it as part of the loop of a function similar to modbm. I will name it modbm2. Last fiddled with by 3.14159 on 2010-08-11 at 18:58 |
|
|
|
|
|
|
#263 |
|
Aug 2006
3×1,993 Posts |
If you fix that, does it work? If so, great. If not, please post the modified code, seeing that both modbmpsp and modbm needed to be changed. (Edit: all the code, if you can -- p, modbm*, isPRP, and whatever else you're calling.)
Also, can you describe what these functions are supposed to do? Using addhelp is good practice, but any sort of description could help us follow what you're going for here. Last fiddled with by CRGreathouse on 2010-08-11 at 19:02 |
|
|
|
|
|
#264 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
look to get a value out of a function and used by other functions if the first code returns nothing it is assumed to return 0 I think and so the value you are test as the first part of if (isprp() or what ever that part is is returning 0 since its variables are used later with no initial value they are assumed 0 and so mod by 0 error occurs. so to solve it the value outside of 0 of the other function so that other functions can use it.
|
|
|
|
![]() |
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 |