Ask Your Question

Revision history [back]

The symbolic sum:

sage: def y_symbolic(x): return sum(log(p)/p for p in prime_range(1,x))
sage: y_symbolic(4)
1/3*log(3) + 1/2*log(2)
sage: RR(y_symbolic(4))
0.712777686502676

The sum of reals:

sage: def y_real(x): return sum(RR(log(p)/p) for p in prime_range(1,x))
sage: y_real(4)
0.712777686502676

The individual terms in the real sum:

sage: def y_real_terms(x): return [RR(log(p)/p) for p in prime_range(1,x)]
sage: y_real_terms(4)
[0.346573590279973, 0.366204096222703]

etc.

The symbolic sum:

sage: def y_symbolic(x): return sum(log(p)/p for p in prime_range(1,x))
sage: y_symbolic(4)
1/3*log(3) + 1/2*log(2)
sage: RR(y_symbolic(4))
0.712777686502676

The sum of reals:

sage: def y_real(x): return sum(RR(log(p)/p) sum(log(RR(p))/p for p in prime_range(1,x))
sage: y_real(4)
0.712777686502676

The individual terms in the real sum:

sage: def y_real_terms(x): return [RR(log(p)/p) for p in prime_range(1,x)]
sage: y_real_terms(4)
[0.346573590279973, 0.366204096222703]

etc.

The symbolic sum:

sage: def y_symbolic(x): return sum(log(p)/p for p in prime_range(1,x))
sage: y_symbolic(4)
1/3*log(3) + 1/2*log(2)
sage: RR(y_symbolic(4))
0.712777686502676

The sum of reals:

sage: def y_real(x): return sum(log(RR(p))/p for p in prime_range(1,x))
sage: y_real(4)
0.712777686502676

The individual terms in the real sum:

sage: def y_real_terms(x): return [RR(log(p)/p) [log(RR(p))/p for p in prime_range(1,x)]
sage: y_real_terms(4)
[0.346573590279973, 0.366204096222703]

etc.