1
$\begingroup$

I've done this:

N[Sum[(10^(n*2) + 1)/(10^(n^2*2)*(10^(n*2) - 1)), {n, 1, Floor[49^(1/2)]}], (49)*2]
0.010202030204020403040206020404050206020604040208030404060208020604040409020404080208020606040210031
str = StringDrop[ToString@%, 2]
"010202030204020403040206020404050206020604040208030404060208020604040409020404080208020606040210031"
Last /@ StringPosition[str, "02"]/2
 {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}

Now I'm trying to make a positive form of the formula that can calculate over a specified range. The closest I've come is below but it is still not quite right. I can't figure out what I'm doing wrong. The math isn't right yet.

N[Sum[
   Floor[(2*10^((49 - 10) - Mod[-(10 - n^2), n]*2))/((10^n - 1)*2)], 
   {n, 1, Floor[(49 - 10)^(1/2)]}], 
  50]
1.2122223151322251224141332151323142322100000000000*10^38

That is the answer I get, but I'm looking for an answer that is like this,

0.0206020404050206020604040208030404060208020604040409020404080208020606040210031

and after applying

str = StringDrop[ToString @ %, 2]
Last /@ StringPosition[str, "02"]/2 + 10

it should further yield

{11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}

and I've done this last part and it does yield the desired result. If only I could find what to change in the formula to yield the first part. Please help.

$\endgroup$
  • $\begingroup$ First of all, it would be helpful if I knew a way to copy and paste that would preserve the sigma notation or traditional form of what I copy. I hear about latex, but there is no "copy as latex" option. I tried recopying from the browser back into mathematica and I got a non-functional version. I notice everyone else pastes into the nice blue boxes, how do I do that as well? $\endgroup$ – user24719 Feb 14 '15 at 19:17
  • 1
    $\begingroup$ It seems to me that your issue is more with mathematics than with Mathematica. $\endgroup$ – m_goldberg Feb 14 '15 at 19:48
0
$\begingroup$

I just invented this last week

Copy the following into Mathematica, select all, right-click on Convert To, choose StandardForm.

N[Sum[2/10^((n*(Floor[c/n] + 1) - c)s), {n, 1, Floor[Sqrt[ c]]}] + Sum[ 2/(10^((n(Floor[c/n] + 1) - c)s) (10^(ns) - 1)), {n, 1, Floor[Sqrt[ c]]}] + Sum[2/(10^((o^2 - o - c) s)(10^(os) - 1)), {o, Floor[Sqrt[c]] + 1, max}], ((max + 1)^2 - c)*s]; AbsoluteTiming[Flatten[ Position[Partition[ RealDigits[%][[1]], s, s, -1], {(0) .., 2}]]] + c

-end

c=crossover s=spacing

The crossover is the number which you want to surpass. The spacing is difficult to determine, so I'll say that in general, if you use a number which is equal to the number of digits of the max^2, you should be safe. So for all primes up to 100^2 = 10000, that is five digits, so use a 5 for the spacing. Follow this rule and you should be safe.

For those who are wondering, the code is based on a bigger structure of numbers formed by the Sieve of Eratosthenes.

$\endgroup$
-2
$\begingroup$

I was successful in working out the bugs, now I can specify a range of numbers that I want to test for primality. I'll provide an example, here I test for primes between 10 and 100

N[Sum[2/(10^(Mod[-(10 - n^2), n]*4)*
          (10^(n*4) - 1)), 
     {n, 1, Sqrt[10000]}], (10000 - 10)*4]
str = StringDrop[ToString[%], 2]
(1/4)*Last /@ StringPosition[str, 
         "0002"] + 10

Out[175]= \ 0.02040204060602080210060402120404060802120208040406120204041202100206\ 0804021204080406021004100404021402040808040802060410021402040606040802\ 1206040212040404080214040604040412020606100

Out[176]= \ "020402040606020802100604021204040608021202080404061202040412021002060\ 8040212040804060210041004040214020408080408020604100214020406060408021\ 206040212040404080214040604040412020606100"

Out[177]= {11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, \ 67, 71, 73, 79, 83, 89, 97}

It's really easy, just follow the formula:

[\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), 
RadicalBox[\(max\), \(2\)]]\(2/
   10^\((\((Mod[\(-\((\((min)\))\)\) - \((n^2)\), 
        n])\) spacing)\) \((\((10^\((n*spacing)\))\) - 
    1)\)\)\), (max - min)*spacing]

For those of you who are following, you will need to know how to find the spacing. The spacing is determined using a couple of formulas, in these examples below, I am solving for the LCM of 1-1000. The First Formula, I would keep adding the log10 of primes until I arrive at the max number I want to test for. Once I find that prime, I input that into the second formula to find the bonus range. The output from the first formula and the second are added together properly by converting the logs back into numbers first before adding them together, otherwise just adding the logs is like multiplying those numbers together. This yields the overall max that could be used to test with. The third formula yields the number of divisors of an LCM of 1-n and taking the log10 of it determines the spacing needed to pad the decimal expansion with. Using that prime number again from the first formula, it is inputted into the third formula to yield the spacing. It all looks like this:

AbsoluteTiming[N[Sum[Log[Prime[n]]/Log[10], {n, 1, 1000}], 13]]

{0.031222, 3392.831632804}

N[10^3392.83163280386907722938003534866124707481`13.]

6.78629608*10^3392

N[Sum[(1/Log[10])*(-2 + x)*Log[Prime[p + PrimePi[1000^(1/x)]]], 
     {x, 3, 1 + Floor[Log[1000]/Log[2]]}, 
     {p, 1, PrimePi[1000^(1/(-1 + x))] - PrimePi[1000^(1/x)]}], 13]

17.56097841949

N[10^17.56097841949371816986880298169279418524`13.]

3.63897*10^17

6.786296084197555149532660048969925646446`9.107222002718924*^3392 + \
3.63896953291872`*^17

6.786296084197555*10^3392 is the max

N[1 + Floor[Log10[Product[x^(PrimePi[Prime[1000]^(1/(-1 + x))] - 
                PrimePi[Prime[1000]^(1/x)]), 
           {x, 2, 1 + Floor[Log[Prime[1000]]/Log[2]]}]]]]

Out[178]= 308.

308 is the spacing required to test for primes under the max, 6.786296084197555*10^3392. That alot of primes for such little spacing. Pretty neat, right? Don't forget to vote, I could use some reputation improvement.
Oh, I just got an answer on how to get more zeros in front of the two so that you will have something to search with. Use:

PaddedForm[2, spacing, NumberPadding -> {"0", "0"}]

And I should point out that my computer is pretty tops, and it easily does a range of 10000 at a time. I wouldn't try for 6.786296084197555*10^3392. It was just an example, sorry I didn't use one that is practical or usable. A spacing of 4 will get you pretty far, up to 6.46969359`*^9 at least.

One more thing, a bug I haven't worked out yet but is easy to work around, when you do get the display of primes and there is a number that did not divide by the spacing, it will display as a fraction and can be ignored as a false positive. I've seen a lot of false positives when the computer comes across a 0022 instead of a 0002. I've compared lists and they do happen, it's not a perfect system yet. That will be my next question...

$\endgroup$
  • $\begingroup$ This isn't actually an answer to the question, is it? $\endgroup$ – Gerry Myerson Feb 15 '15 at 12:12
  • $\begingroup$ Yes it is, and a lot more. I wanted to fully disclose my formulas so that if anyone wishes to use it, they can. $\endgroup$ – user24719 Feb 25 '15 at 5:04
  • $\begingroup$ An update, I do have a new formula now that is very quick and efficient. It is efficient because I do the same amount of work required to prove one number is prime, yet because I utilize repeating numbers, I cover greater stretches of numbers with each computation. The beauty of what I am doing now is I am now using the Prime[n] to give me the initial inputs, and then the formula will output / yield the further primes up to the square of the last prime used. The first iteration uses P^1 and yeilds up to P^2. Then P^2 to P^4... so after "n" iterations, the yield is P^(2^n). $\endgroup$ – user24719 Sep 14 '15 at 5:19
  • $\begingroup$ I plan on using my new formula to get primes slightly over 10^(10^8) and 10^(10^9) to claim the EFF Prizes. Also, I have a way of inputting a certain form of number, let's say because of the big interest in Mersenne primes, (2^n)-1, and outputting numbers that are both Mersenne numbers and prime. Researchers interested in certain forms of primes would benefit. I theorized a way to break an encryption into it's keys, yet I don't want to develop what could be the next Atomic bomb. And the U.S. government spies on us enough already. Watch "Frontline: United States of Secrets". $\endgroup$ – user24719 Sep 14 '15 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.