Using lbc instead of lmapm would be easier because lbc is self-contained.
local bc = require"bc"
s=bc.pow(2,1000):tostring()
z=0
for i=1,#s do
z=z+s:byte(i)-("0"):byte(1)
end
print(z)
More Related Contents:
- Arbitrary-precision arithmetic Explanation
- Why does floating-point arithmetic not give exact results when adding decimal fractions?
- Divide by 10 using bit shifts?
- Mathematically compute a simple graphics pipeline
- How to calculate modulus of large numbers?
- Cone to box collision
- How do I calculate the normal vector of a line segment? [closed]
- Changing a matrix from right-handed to left-handed coordinate system
- Calculating area enclosed by arbitrary polygon on Earth’s surface
- Implementing Ray Picking
- Arbitrary-Precision Decimals in C# [duplicate]
- What is “entropy and information gain”?
- Signed angle between two 3D vectors with same origin within the same plane
- Quadratic Bézier Curve: Calculate Points
- How do I detect intersections between a circle and any other circle in the same plane?
- Why must a nonlinear activation function be used in a backpropagation neural network? [closed]
- How to map atan2() to degrees 0-360
- how map 2d grid points (x,y) onto sphere as 3d points (x,y,z)
- Cracking short RSA keys
- 3D coordinates on a sphere to Latitude and Longitude
- Calculate rotated rectangle size from known bounding box coordinates
- The possible number of binary search trees that can be created with N keys is given by the Nth catalan number. Why?
- Line of intersection between two planes
- Flipping a quaternion from right to left handed coordinates
- Why use softmax as opposed to standard normalization?
- How to perform division in Go
- Math – mapping numbers
- Get bounds of rotated rectangle
- Get direction (compass) with two longitude/latitude points
- Drawing part of a Bézier curve by reusing a basic Bézier-curve-function?