![]() |
I'm leaning towards the latter being true.
@sm88: Too many arguments, failed to specify whether or not a=1 was part of the command, a=1 treated as its own command |
[QUOTE=3.14159;226216]I'm leaning towards the latter being true.
@sm88: Too many arguments, failed to specify whether or not a=1 was part of the command, a=1 treated as its own command[/QUOTE] it should be it's own command. it's only when i used concat() that this happened. |
[QUOTE=3.14159;226214]Nope. I changed nothing. It was either incredible luck or the computer fucking up.[/QUOTE]
I'm leaning toward "you used a as a variable in a function without using local or my" which would explain it pretty well. |
[QUOTE=3.14159;226216]@sm88: Too many arguments, failed to specify whether or not a=1 was part of the command, a=1 treated as its own command[/QUOTE]
[QUOTE=science_man_88;226217]it should be it's own command. it's only when i used concat() that this happened.[/QUOTE] I don't know what either of these mean. |
[QUOTE=CRGreathouse]I'm leaning toward "you used a as a variable in a function without using local or my" which would explain it pretty well.
[/QUOTE] Nope. I defined f(x, n) as follows: Print nextprime(x), followed by * , followed by nextprime(n), followed by printing the product of those two. In other words, a semiprime generator that gives the factors used to produce the semiprime as well. a(n) = nextprime(random(10^n)). a and f were well-defined. a was never a variable, it is a function. a simply gives an n-digit prime most of the time. Therefore, there was no error in my defined functions. |
[CODE] v=vector(1250,n,0);a=1;for(x=1,10000,if(isprime(x),v[a]=x;a=a+1))[/CODE]
works but you already have to know the # of primes under the x upper bound to not get an error or a 0 at the end. what I want to do is add a 0 into v every time a prime is found so as to have no 0's at the end of it all and to only have the number of indices necessary to list all the primes under a given number once the vector is made I can get a sieve like the sieve of Eratosthenes to try and work with it to create a bigger list instead of asking isprime hopefully I can make a way to check primality quicker and then make a function that uses the vector indices to check Prime2(x). |
[QUOTE=CRGreathouse]I don't know what either of these mean.
[/QUOTE] I was merely trying to explain sm88's error. |
[code]v=vector(1,n,0);
a=1; for(x=1,10000, if(isprime(x), v[a]=x; concat(v[],0); a=a+1 ) )[/code] I'm not sure what "concat(v[],0);" is trying to do, but it's not right. v[] will cause an error. If you replace v[] with something that isn't an error, like v, then the result would take v and concatenate it with 0, then throw the result away. Maybe you mean [code]v=concat(v,0);[/code] which would take v, append 0 to the end, and replace the old v with the "old v followed by a 0" vector. Here's how I would do what I think you're trying to do: [code]v=[]; for(x=1,10000, if(isprime(x), v=concat(v,x) ) )[/code] or even [code]v=[]; forprime(p=2,10000, v=concat(v,p) )[/code] or even [code]v=vector(primepi(10000)); i=0; forprime(p=2,10000, i++; v[i]=p )[/code] which I would usually write in the confusing programmer-ese as [code]v=vector(primepi(10000)); i=0; forprime(p=2,10000, v[i++]=p )[/code] |
[QUOTE=3.14159;226220]Nope. I defined f(x, n) as follows:
Print nextprime(x), followed by * , followed by nextprime(n), followed by printing the product of those two. In other words, a semiprime generator that gives the factors used to produce the semiprime as well. a(n) = nextprime(random(10^n)). a and f were well-defined. a was never a variable, it is a function. a simply gives an n-digit prime most of the time. Therefore, there was no error in my defined functions.[/QUOTE] Did you put in ?a ? What did it say? |
now if I only I could be smart like you so I could build you that helpful program lol.
|
[QUOTE=CRGreathouse]Did you put in ?a ? What did it say?
[/QUOTE] ?a = a(n) = nextprime(10^n)) |
| All times are UTC. The time now is 23:07. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.