Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168756
Image: ubuntu2004
@parallel(2) def f(n): return factorial(n).ndigits()
list(f([1,2,3,4]))
[(((2,), {}), 1), (((1,), {}), 1), (((3,), {}), 1), (((4,), {}), 2)]
def g2(n): return factorial(n).ndigits()
timeit('g2(100)')
625 loops, best of 3: 8.01 µs per loop
@fork(timeout=1) def g(n): return factorial(n).ndigits()
g(100)
158
timeit('g(100)')
25 loops, best of 3: 29.6 ms per loop
g(10^5)
456574
g(10^7)
Killing subprocess 85847 with input ((10000000,), {}) which took too long 'NO DATA (timed out)'
g(10^5)
456574
@fork def g(n): return factorial(n).ndigits()
g(10^5)
456574
@fork def g(n): sys.exit(1) return factorial(n).ndigits()
g(100)
'NO DATA'
g(5)
'NO DATA'
%cython def h(): print <char*>0
@fork def g(n): h()
a =5
g(100)
------------------------------------------------------------ Unhandled SIGSEGV: A segmentation fault occurred in Sage. This probably occurred because a *compiled* component of Sage has a bug in it (typically accessing invalid memory) or is not properly wrapped with _sig_on, _sig_off. You might want to run Sage under gdb with 'sage -gdb' to debug this. Sage will now terminate (sorry). ------------------------------------------------------------ 'NO DATA'
a
5
g(100)
------------------------------------------------------------ Unhandled SIGSEGV: A segmentation fault occurred in Sage. This probably occurred because a *compiled* component of Sage has a bug in it (typically accessing invalid memory) or is not properly wrapped with _sig_on, _sig_off. You might want to run Sage under gdb with 'sage -gdb' to debug this. Sage will now terminate (sorry). ------------------------------------------------------------ 'NO DATA'