1 | initial version |
Given your number x,an obvious "brute-force" one-liner is :
def foo(x): return map(lambda(t):prime_pi(t[0]), factor(x))
bar=Integer(round(10^10*random()))
bar
7218184858
foo(bar)
[1, 1211, 31354]
HTH,
2 | No.2 Revision |
prime_pi?
Type: PrimePi
String form: prime_pi
File: /usr/local/sage-8/local/lib/python2.7/site-packages/sage/functions/prime_pi.pyx
Docstring:
The prime counting function, which counts the number of primes less
than or equal to a given value.
INPUT:
* "x" - a real number
* "prime_bound" - (default 0) a real number < 2^32, "prime_pi"
will make sure to use all the primes up to "prime_bound"
(although, possibly more) in computing "prime_pi", this can
potentially speedup the time of computation, at a cost to memory
usage.
OUTPUT:
integer -- the number of primes <= "x"
Given So, given your number x,an obvious "brute-force" one-liner is :
def foo(x): return map(lambda(t):prime_pi(t[0]), factor(x))
bar=Integer(round(10^10*random()))
bar
7218184858
foo(bar)
[1, 1211, 31354]
HTH,
3 | No.3 Revision |
prime_pi?
Type: PrimePi
String form: prime_pi
File: /usr/local/sage-8/local/lib/python2.7/site-packages/sage/functions/prime_pi.pyx
Docstring:
The prime counting function, which counts the number of primes less
than or equal to a given value.
INPUT:
* "x" - a real number
* "prime_bound" - (default 0) a real number < 2^32, "prime_pi"
will make sure to use all the primes up to "prime_bound"
(although, possibly more) in computing "prime_pi", this can
potentially speedup the time of computation, at a cost to memory
usage.
OUTPUT:
integer -- the number of primes <= "x"
So, given your number x,an obvious "brute-force" one-liner is :
def foo(x): return map(lambda(t):prime_pi(t[0]), map(lambda(t):prime_pi(t[0],sqrt(x)), factor(x))
bar=Integer(round(10^10*random()))
bar
7218184858
foo(bar)
[1, 1211, 31354]
HTH,