hermann on Sun, 05 May 2024 09:30:50 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Questions on accessing string character/substring and "F=readvec(...);F=F[#F];" |
Based on data from http://www.prothsearch.com/fermat.html I created new gist with factors of Fermat numbers F0..F32: https://gist.github.com/Hermann-SW/df18355362f5cce70da6a2d5f20a22ca 1) While reading Fermat.gp, its entries get verified.Some rightmost prime factors are not numbers but eg "P252" for 252 decimal digit prime factor of F10. So I needed to access that string's first character (to differ from composites like @C1133@).
I found no such command in GP user guide.Also I did need to access substring starting at second character and convert it to number.
With that number correctness for eg F10 row can be proven: $ grep F10 Fermat.gp[45592577, 6487031809, 4659775785220018543264560743076778192897, "P252"], \\ F10
$I did that with this code, for which I want to ask whether simpler string commands exist?
... p=vecprod(v[1..#v-1]); assert(f%p==0); if(Vec(s)[1]=="P", assert(#digits(f\p)==eval(strjoin(Vec(s)[2..#s]))); F__[1+i][#v]=f\p; ) ... 2)During reading verification the array gets modified, all "P..." values are replaced by last command in above "if". With F[#F] I can access the array with replacements, with F[1] the unmodified array:
? F=readvec("Fermat.gp");F=F[#F]; ? F[1+8][1238926361552897, 93461639715357977769163558199606896584051237541638188580280321]
? F=readvec("Fermat.gp");F=F[1]; ? F[1+8] [1238926361552897, "P62"] ?I had to use internal variable "F__" in Fermat.gp to achieve that (last line). Can I achieve what I described without namespace pollution "F__" in Fermat.gp ?
Regards, Hermann.