Search NKS | Online
1 - 8 of 8 for Pi
This was found empirically by Carl Friedrich Gauss in 1792, based on looking at a table of primes. ( PrimePi[10 9 ] is 50,847,534 while LogIntegral[10 9 ] is about 50,849,235.) … According to the Riemann Hypothesis, the difference between PrimePi[n] and LogIntegral[n] is of order √ n Log[n] . More refined analytical estimates of PrimePi[n] are good enough that they are used by Mathematica to compute Prime[n] for large n .
Huffman coding
From a list p of probabilities for blocks, the list of codewords can be generated using
Map[Drop[Last[#], -1] &, Sort[ Flatten[MapIndexed[Rule, FixedPoint[Replace[Sort[#], {{p0_, i0_}, {p1_, i1_}, pi___} {{p0 + p1, {i0, i1}}, pi}] & , MapIndexed[List, p]] 〚 1, 2 〛 , {-1}]]]] -1
Given the list of codewords c , the sequence of blocks that occur in encoded data d can be uniquely reconstructed using
First[{{}, d} //.
Given p = Array[Prime, Length[list], PrimePi[Max[list]] + 1] or any list of integers that are all relatively prime and above Max[list] (the integers in list are assumed positive)
CRT[list_, p_] := With[{m = Apply[Times, p]}, Mod[Apply[Plus, MapThread[#1 (m/#2)^EulerPhi[#2] &, {list, p}]], m]]
yields a number x such that Mod[x, p] list . Based on this
LE[list_] := Module[{n = Length[list], i = Max[MapIndexed[ #1 - #2 &, PrimePi[list]]] + 1}, CRT[PadRight[ list, n + i], Join[Array[Prime[i + #] &, n], Array[Prime, i]]]]
will yield a number x that can be decoded into a list of length n using essentially the so-called Gödel β function
Mod[x, Prime[Rest[NestList[NestWhile[# + 1 &, # + 1, Mod[x, Prime[#]] 0 &] &, 0, n]]]]
The facts in question concern the sequences of digits in numbers like π (pi).
The zeta function as analytically continued for complex s was studied by Bernhard Riemann in 1859, who showed that PrimePi[n] could be approximated (see page 909 ) up to order √ n by LogIntegral[n] - Sum[LogIntegral[n^r[i]], {i, - ∞ , ∞ }] , where the r[i] are the complex zeros of Zeta[s] . The Riemann Hypothesis then states that all r[i] satisfy Re[r[i]] 1/2 , which implies a certain randomness in the distribution of prime numbers, and a bound of order √ n Log[n] on PrimePi[n] - LogIntegral[n] .
Given an original DNF list s , this can be done using PI[s, n] :
PI[s_, n_] := Union[Flatten[ FixedPointList[f[Last[#], n] &, {{}, s}] 〚 All, 1 〛 , 1]]
g[a_, b_] := With[{i = Position[Transpose[{a, b}], {0,1}]}, If[Length[i] 1 && Delete[a, i] === Delete[b, i], {ReplacePart[a, _, i]}, {}]]
f[s_, n_] := With[ {w = Flatten[Apply[Outer[g, #1, #2, 1] &, Partition[Table[ Select[s, Count[#, 1] i &], {i, 0, n}], 2, 1], {1}], 3]}, {Complement[s, w, SameTest MatchQ], w}]
The minimal DNF then consists of a collection of these prime implicants.
Digits of pi
The digits of π shown here can be obtained in less than a second from Mathematica on a typical current computer using N[ π , 7000] .
The number of ways of writing an integer n as a sum of two primes can be calculated explicitly as Length[Select[n - Table[Prime[i], {i, PrimePi[n]}], PrimeQ]] .