![Rail maze 1 20.northeast](https://loka.nahovitsyn.com/7.jpg)
![power of ten math power of ten math](https://www.mathssupport.org/wp-content/uploads/2022/08/AI2_3_1Graph-of-functions.jpg)
When is a number prime? If it itself is not less than $2$ and not the product of two integers greater or equal to $2$. Therefore you could expand the abbreviations level by level to get back to the strict notation of TNT. But note that every such abbreviation only builds on those I have defined before, not itself or the ones coming afterwards. To keep things understandible, I'll define abbreviations for semantic units. $d$ will often be a digit or element of that set of powers of ten. $p$ will be a prime number used as number base, $t$ the base- $p$ number used to encode our powers of ten.
Power of ten math free#
I'll use $a$ to denote the free variable, the input, the thing we want to check the predicate for. We can't do digit shifting in base 10 yet, but we can express powers of ten in some prime base. Lacking sets, we have to represent this as a single number. One way to tackle this is by speaking about all powers of ten, at least up to the given number, simultaneously. You can't have the formula build on itself. The main problem is that you can't simply write down a recursive definition. It is now inspired by this post by Anders Kaseorg, although the wording is mine.
![power of ten math power of ten math](https://cdn.mos.cms.futurecdn.net/hGWstD5LKS3UfEEKzgvAnC-1200-80.jpg)
In my first attempt to do so, I have made a mistake, so I'm completely rewriting my answer. Also, here standard python's index() may crash, if it will not find at least one of non-zero element from interval, that is why in the end I must "filter" listing by occurrence: if str(j) in "%.100f" % i.Īdditionally, to get deeper precise - %.100f may be taken differ.Since Rory already covered the problems with your approach, I'll tackle the question of finding a different solution. And decrease by one, it is first zero, which shall be counted. To get first non zero element after comma, I've used such construction ("%.100f" % i).replace('.', '').index(k), where k run over interval. And last case, when i
![power of ten math power of ten math](https://i.pinimg.com/originals/19/46/29/194629b246ae1e2bc3fda0dba523030e.jpg)
Little branching: i > 1.0 and i > 0.1 it is 10 and 1 respectively. So, first part, for input i > 1.0 - it is ten 10 in power of this length.
Power of ten math code#
This code based on principle of ten's power in len(str(int(float_number))).įloat number - converted to int, thereafter string str() from it, will give us a string with length which is we are looking exactly. This finds lots of failures in the naive implementation, but none in the improved implementation. Something along the lines of def nextpow10(n): So for a robust solution for floats and ints we need to assume that the value of our logarithm is only approximate, and we must therefore test a couple of possibilities. It is also theoretically possible for it to fail in the other direction, though this seems to be much harder to provoke. First of all n is converted from whatever data type it happens to have into a double precision floating point number, potentially introducing rounding errors, then the logarithm is calculated potentially introducing more rounding errors both in its internal calculations and in its result.Īs such it did not take me long to find an example where it gave an incorrect result. Unfortunately this suffers from rounding errors. In another answer it was proposed to take the logarithm, then round up (ceiling function), then exponentiate.
![power of ten math power of ten math](https://static1.cbrimages.com/wordpress/wp-content/uploads/2021/03/DC-Super-Hero-Girls-Teen-Power-Wonder-Woman-Header.jpg)
![Rail maze 1 20.northeast](https://loka.nahovitsyn.com/7.jpg)