![]() |
|
|
#1365 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
one more thing worked out and I think I have it for one find replace then it's a matter of vectors i think.
|
|
|
|
|
|
#1366 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Code:
%135 = (string_to_search,string_to_find)->my(s1=Vec(string_to_search),s2=Vec(string_to_find),good);c="";d="";for(i=0,#s1-#s2,good=1;for(j=1,#s2,if(s2[j]!=s1[j+i],good=0;c=concat(c,s1[i+1]);break));if(good,d=concat(c,"loser!");print1(d);c="";i=i+#s2))
(18:51) gp > substring("hello Alex, Good bye Alex","Alex") c="";i=i+#s2))
hello loser! Good bye loser!
<s2[j]!=s1[j+i],good=0;c=concat(c,s1[i+1]);break));if(good,d=concat(c,"loser!");print1(d);c="";i=i+#s2))
|
|
|
|
|
|
#1367 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
which could be done with a further script part to multi-search with Vec()
|
|
|
|
|
|
#1368 |
|
Aug 2006
3·1,993 Posts |
It looks like you have it working the way you want.
|
|
|
|
|
|
#1369 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
well I think one more change may help. then you can apply it to Vec of Vec to do find and replace and maybe even a Vec of Vec to call each Vec of Vec to search multiple functions to make it search for ? or do you want me to set up Vec although you want to Use it on your PC it may need them to do multiple searches autonomously.
|
|
|
|
|
|
#1370 |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
Code:
%4 = (string_to_search,string_to_find,string_to_replace_with)->my(s1=Vec(string_to_search),s2=Vec(string_to_find),s3=string_to_replace_with,good);c="";d="";for(i=0,#s1-#s2,good=1;for(j=1,#s2,if(s2[j]!=s1[j+i],good=0;c=concat(c,s1[i+1]);break));if(good,d=concat(c,s3);print1(d);c="";i=i+#s2))
(19:58) gp > FaR("Hello Alex","Alex","loser!") c="";i=i+#s2))
Hello loser!
(19:58) gp >
|
|
|
|
|
|
#1371 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Code:
(19:58) gp > primorial=["primorial","prime factorial"]
%5 = ["primorial", "prime factorial"]
(20:06) gp > for(x=2,#primorial,FaR("I want the prime factorial",primorial[x],primorial[1])
*** syntax error, unexpected $end, expecting KPARROW or ',' or ')': ...primorial[x],primorial[1])
^-
(20:08) gp > for(x=2,#primorial,FaR("I want the prime factorial",primorial[x],primorial[1]))
I want the primorial
|
|
|
|
|
|
#1372 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
Give me Vec with technical names and non technical descriptions and maybe I can try for multiple Vec to check through using a matrix etc.
|
|
|
|
|
|
#1373 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
10 Aug 10, 08:52 PM is my first post on a scriptwriter (page 7) so under a month and with arguments we've figured it out lol.
mostly* Last fiddled with by science_man_88 on 2010-09-09 at 00:39 |
|
|
|
|
|
#1374 | |
|
Aug 2006
3·1,993 Posts |
Quote:
http://mymathforum.com/viewtopic.php?f=40&t=14769i Code:
trinv(n)=(sqrtint(8*n-7)+1)>>1
forprime(p=2,1e9,if(is(p,trinv(p)),print("S_0 = "p", c = "trinv(p))))
Code:
Cohn(P,a='x)={
my(d=poldegree(P,a),an=polcoeff(P,d,a),b=0);
for(i=0,d-1,b=max(b,abs(polcoeff(P,i,a))));
b=ceil(b/an)+1;
while(1,
if(isprime(substpol(P,a,b++)),return(b))
)
};
addhelp(Cohn, "Cohn(P): If P is an irreducible polynomial, return a proof certificate p; otherwise, infinite loop. Based on Ram Murty 2002.");
Code:
for(n=6000,0,if(isprime(n) && 6000%n==0, print(n))) forstep(n=6000,0,-1,if(isprime(n) && 6000%n==0, print(n))) for(n=0,6000,if(isprime(n) && 6000%n==0, print(n))) forprime(p=0,6000,if(6000%p==0, print(p))) fordiv(6000,n,if(isprime(n), print(n))) f=factor(6000)[,1]; for(i=1,#f,print(f[i])) Code:
step(M)=my(m,MM=matrix(4,4));for(i=1,4,for(j=1,4,m=M[i,j];if(i==4|j==4,MM[i,j]+=m*1087,if(i==3&j==3,MM[i,j]+=425*m,MM[i+1,j+1]+=425*m);MM[i+1,j]+=187*m;MM[i,j+1]+=475*m)));MM matrix(4,4,x,y,x==1&y==1) step(%) Code:
er(n)=my(s=eval(Vec(Str(8*n))),n=0);for(i=1,#s,if(s[i]&s[i]!=8,n=10*n+s[i]));n err1(n,verbose=0)=my(nn,orig=n);while(nn!=n,nn=n;if(n=er(n)<orig,return())) for(n=1,1e8,err1(n)) Code:
factorPueo(P = 2009)={
my(m=1, k=(sqrtint(1+8*P)-1)>>1, NB=k*(k+1)/2, NA=NB+m+k, i);
\\ m = 1 is a triangle number; solve k*(k1)/2 = P for k
\\ define two numbers, NB = S(m,k) and NA = S(m,k+1), that bracket P
while(NB!=P,
while(NB > P, \\ is NB too large?
NA = NB;
NB -= m + k - 1;
k -= 1
);
while(NA <= P, \\ is NA too small?
NB = NA;
NA += m + k + 1;
k += 1
);
if(NB < P,
NB += k; \\ make NB larger using [6] above to increase m
NA += k + 1; \\ make NA larger using [7] above to increase m
m += 1
)
);
i = k;
if(i%2 == 0, \\ if k is even, divide by 2 to get factor of P
i /= 2
);
j = P/i;
print("S("m","k") = "P);
print(i" * "j" = "i*j);
};
Last fiddled with by CRGreathouse on 2010-09-09 at 04:36 |
|
|
|
|
|
|
#1375 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
you're over worked and underpaid.
I've got the basics of math English down with this code though I'll make more list. if you look at it correcting typo is a task it would need to be AI complete. the more tasks we need it to do and the more Vec we need to do this the more memory intensive it would be. |
|
|
|
![]() |
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 |