Need an HP employee to answer this question

06232017, 10:59 PM
Post: #1




Need an HP employee to answer this question
Im currently exploring a possible proof to Goldbach's conjecture in number theory.
I have a function (NPRIMES) I wrote to calculate the exact number of primes <= N. In there I use the isPrime() function. Now I figured this function used a sieve or some other such algorithm. So, I reasoned that if I wrote a faster version that used the Fermat primality test, which is to calculate (a^(n1))MOD n and show that it equals 1 for 3 different values of a coprime with n. If it equals 1 for all values of a, then n is prime. I used the powmod function to calculate this. However, in my NPRIMES function, I got no noticable speedup by using the Fermat primality test. Now, my questions are: 1. What algorithm is used to calculate isPrime(). I need someone from HP that has access to the source code to tell me this. Is it a sieve or does it already use Fermat's primality test...or what? 2. Does the powmod function use the speedup trick using the properties: (axb)MODc = (aMODc x bMODc)MOD c and (g^2)MODp = (gMODp)^2 MOD p ....and thus avoiding having to use integers greater than p. ...or does it use the CAS ability to actually calculate g^n exactly using the full 2500 digit resolution, which would be much slower. Thanks in advance. Donald 

06242017, 02:10 AM
Post: #2




RE: Need an HP employee to answer this question
https://wwwfourier.ujfgrenoble.fr/~par...mpile.html
When it comes to CAS questions, we generally can't answer as we didn't write it. There is the source code for the CAS at that link though. Unzip it, search for at_powmod or "powmod" and you'll get into the actual functions really quick. Else the CAS author might post here if he notices. TW Although I work for the HP calculator group, the views and opinions I post here are my own. 

06242017, 06:11 AM
Post: #3




RE: Need an HP employee to answer this question
isPrime does the MillerRabin test on the Prime.
powmod(a,n,m) is computed by the fast powering algorithm, it does not compute a^n before taking remainder. nprimes is a Giac/Xcas command, but it is not available on the Prime (perhaps we could add it?). Note that ithprime might be useful to implement nprimes, as a first step using an asymptotic guess. 

06242017, 06:53 AM
(This post was last modified: 06242017 06:53 AM by Anders.)
Post: #4




RE: Need an HP employee to answer this question
to parisse's point, Yes we (HP) should add it, long with all the other missing commands from full Giac/Xcas.


06242017, 11:35 AM
Post: #5




RE: Need an HP employee to answer this question
Thanks guys, I gotta remember that CAS is based on XCAS.
Parisse answered my questions. Thx D 

06242017, 12:47 PM
Post: #6




RE: Need an HP employee to answer this question
(06232017 10:59 PM)webmasterpdx Wrote: Im currently exploring a possible proof to Goldbach's conjecture in number theory. That reminded me of this: http://www.hpmuseum.org/forum/thread338...t=Goldbach. It's been awhile and it's been a few firmware rev's, but maybe it still works(?) 

06242017, 05:46 PM
(This post was last modified: 06242017 06:48 PM by Tim Wessman.)
Post: #7




RE: Need an HP employee to answer this question
(06242017 06:53 AM)Anders Wrote: to parisse's point, Yes we (HP) should add it, long with all the other missing commands from full Giac/Xcas. If someone can provide the list of all these "missing" commands I'd be happy to look at it and do so. Every time I've asked there is a vague "well they should just all be there" and yet the only things that have been removed are those that can't be used (licensing problems), duplicates (in some cases, 4 keywords that are the same command), and things that don't make sense due to system architecture (.wav processing, direct file access to the drive, etc), or things that have been added and I just don't have a clue are there. In this case, I'm pretty sure nprimes was added later after the initial inclusion of CAS stuff at the beginning of the Prime and I frankly wasn't aware of it. Recently, I turned on "chisquaret", "kolmogorovd", "kolmogorovt", "multinomial", "randvector", "wilcoxonp", "wilcoxons", "wilcoxont" as I had a bit of time. Would love to add more. TW Although I work for the HP calculator group, the views and opinions I post here are my own. 

06242017, 07:16 PM
Post: #8




RE: Need an HP employee to answer this question
(06242017 05:46 PM)Tim Wessman Wrote:(06242017 06:53 AM)Anders Wrote: to parisse's point, Yes we (HP) should add it, long with all the other missing commands from full Giac/Xcas. Not quite "every time". ONCE AGAIN, here's a NONVAGUE list of Xcas commands missing from Prime, including the two very simple and very useful functions I've been repeatedly requesting for years (dfc and dfc2f). Partial List of Xcas functions not in Prime. Synonyms for retained functions are not included in this list. adjoint_matrix Airy_Ai Airy_Bi as_function_of bernoulli blockmatrix border boxwhisker center2interval changebase cloc2 clop2 colspace combine conique_reduite count_eq count_inf count_sup cycle2perm cycleinv cycles2permu det_minor dfc < :( dfc2f < :( epsilon2zero exp2list fdistrib feuille genpoly groupermu heugcd is_cycle is_permu is_pseudoprime isom lll makevector mRowAdd newList ord pari perminv permu2cycles permu2mat permuorder ploc2 plop2 psrgcd quadrique_reduite rationalroot realroot reverse_rsolve roots rowspace semi_augment simp2 simplex_reduce sommet SortA SortD split subsop syst2mat tcoeff unquote user_operator Note: The above Xcas functions are documented in English in "cascmd_en.doc" by Renee & Bernard. <0ɸ0> Joe 

06242017, 08:36 PM
Post: #9




RE: Need an HP employee to answer this question
(06242017 06:53 AM)Anders Wrote: to parisse's point, Yes we (HP) should add it, long with all the other missing commands from full Giac/Xcas. +1 Tom L ...other than that, Mrs. Lincoln, what did you think of the play? 

06252017, 01:56 AM
(This post was last modified: 06252017 02:52 AM by compsystems.)
Post: #10




RE: Need an HP employee to answer this question
more cmds
evalb cmd ? cmd union cmd Missing documentation id cmd with quotes, same nop on xcas (No OPeration cmd) Example so please add it to the help catalog hpprime [subst((abs(2*x1)) = 1,'abs','id'), subst((abs(2*x1)) = 1,'abs','neg')] returns > [(2*x1) = 1, (2*x+1) = 1] (06242017 05:46 PM)Tim Wessman Wrote: If someone can provide the list of all these "missing" commands I'd be happy to look at it and do so. Every time I've asked there is a vague "well they should just all be there" and yet the only things that have been removed are those that can't be used (licensing problems), duplicates (in some cases, 4 keywords that are the same command), and things that don't make sense due to system architecture (.wav processing, direct file access to the drive, etc), or things that have been added and I just don't have a clue are there. 1> duplicates (in some cases, 4 keywords that are the same command) Apparently do the same, eg eval with evalb, Many times I want to see the numeric or symbolic output of a test, so the evalb commands is required. Evalb http://wwwfourier.ujfgrenoble.fr/~pari...html#htoc9 evalb(sqrt(2)>1.42) returns 0 eval(sqrt(2)>1.42) returns false 2: Now the following library has a license problem? 3: Some commands are internally, but the catalog does not appear union with lowercase on cas mode {a,o,u} union {ee,ii} returns set [a, o, u, ee, ii] ? cmd is the infixed version of when function, They do the same but the entry is different help and documentation on catalog (Cond)? (Expr1):(Expr2). If condition Cond=1/true returns Expr1 else returns Expr2. ? cmd ((true)? (123▶var01): (456▶var02)) > when(true,var01:=123,var02:=456) Project Emu48 Skins for android ► https://www.hpmuseum.org/forum/thread14...25336.html 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)