# Revision history [back]

Given your number x,an obvious "brute-force" one-liner is :

def foo(x): return map(lambda(t):prime_pi(t), factor(x))
bar=Integer(round(10^10*random()))
bar
7218184858
foo(bar)
[1, 1211, 31354]


HTH,

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), factor(x))
bar=Integer(round(10^10*random()))
bar
7218184858
foo(bar)
[1, 1211, 31354]


HTH,

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), map(lambda(t):prime_pi(t,sqrt(x)), factor(x))
bar=Integer(round(10^10*random()))
bar
7218184858
foo(bar)
[1, 1211, 31354]


HTH,