hermann on Mon, 25 Sep 2023 06:22:15 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

primorial operator '#' for GP?


GP has factorial operator:
? 11!
%6 = 39916800
?

Similarly primorial is product of first n primes.

prodeuler produces only a floating point approximation:
? prodeuler(p=2,11,p)
%7 = 2310.0000000000000000000000000000000000
?

Something like this is exact:
? P(x)={r=1;forprime(p=2,x,r*=p);r}
%8 = (x)->r=1;forprime(p=2,x,r*=p);r
? P(11)
%9 = 2310
?

Any chance to see "#" as operator in GP like "!"?
? 11#
  ***   syntax error, unexpected '#', expecting end of file: 11#
  ***                                                          ^-
?

Would be useful for eg. working with primorial primes p#±1:
https://en.wikipedia.org/wiki/Primorial_prime


Regards,

Hermann.