Translate

Thursday, June 23, 2005

Partial differential, prime counting

So a few days ago I went through the basic derivation of my prime counting function, and noted that it uses a partial difference equation.

That partial difference equation is

dS(x,y) = (P(x/y,y-1) - P(y-1, sqrt(y-1)))(P(y, sqrt(y)) - P(y-1, sqrt(y-1)))

where

P(x,y) = [x] - S(x,y) - 1

with the constraint that if y>sqrt(x), then P(x,y) = P(x,sqrt(x)), which is necessary to handle the fact that [x/p] - 1 is the count of composites that have a prime p as a factor for a positive integer x, as long as p<=sqrt(x).

And finally, S(x,y) is the sum of dS from 2 to y or sqrt(x) if y>sqrt(x), as it has the same constraint, and S(x,1) = 0, by definition.

It's easy enough to move from the partial difference equation dS(x,y) to a partial differential equation:

ΔS(x,y) = (P(x/y,y-Δy) - P(y-Δy, sqrt(y-Δy)))(P(y, sqrt(y)) - P(y-Δy, sqrt(y-Δy)))

and divide by Δy to get

ΔS(x,y)/Δy = (P(x/y,y-Δy) - P(y-Δy, sqrt(y-Δy)))(P(y, sqrt(y)) - P(y-Δy, sqrt(y-Δy)))/Δy

and let Δy approach 0 to get

S'y(x,y) = (P(x/y,y) - P(y, sqrt(y))) P'(y, sqrt(y))

and now I also have

P(x,y) = x - S(x,y) - 1

and differentiating with respect to y, gives

P'y(x,y) = -S'y

so I have

P'y(x,y) = -(P(x/y,y) - P(y, sqrt(y))) P'(y, sqrt(y))

and a continuous function.

Now you can numerically integrate that and I'm not really up on numerical integration so I made a really basic program and did so, and found that I got values closer to pi(x) than li(x) but a bit further than R(x), but I did just a rough go at it.

To date, I've yet to find anyone to help me with the numerical integration!

If that partial differential integrates to a close value to pi(x) then that could be rather important news.


James

Thursday, June 16, 2005

Counting primes

One of my earlier results comes from a pure thinking exercise on how to count prime numbers as the start is a simple idea: consider a function that gives the count of composites for a particular prime that have that prime as a factor, but no lesser primes as factors.

For instance, up to 10, for 3 that function would give a count of 1, as 9 is the first composite that has 3 as a factor and no lesser primes, while 6 would be excluded as it has 2 as a factor.

Now call that function dS(x,pj) where x is where you're counting up to, and pj is the j_th prime, so my earlier result is dS(10,3) = 1.

Now generalizing a bit, to get the count of composites that have pj as a factor up to and including some x, you can use

floor(x/pj) - 1

where from now on, I'll use [x] = floor(x), so I have

[x/pj] - 1

for the count of composites with pj as a factor.

From that count I need to subtract the number of primes less than pj, which is j-1, so I have


[x/pj] - 1 - (j-1).

Now I need the count of composites up to and including x that have primes less than pj as a factor, which is another function, that is, I now need a function that is the count of composites up to and including some x for all primes less than pj, and I'll use S(x,pj-1), as the count of composites up to and including x that have primes less than pj as factors.

Here's where things are a little tricky as I now have my full dS(x,pj) function as

dS(x,pj) = [x/pj] - 1 - (j-1) - S(x/pj, pj-1)

where S(x/pj, pj-1) is the count of composites that multiply times pj to give a product less than or equal to x, where notice that pj must be less than or equal to sqrt(x) or the composite count given by [x/pj] - 1 will not be correct.

Now I know that in general the count of primes up to and including x is equal to x minus the count of composites minus 1, and that gives an idea for one more function, which I'll call P(x,pj), where

P(x,pj) = [x] - S(x,pj) - 1

which allows me to simplify dS(x, pj) to

dS(x,pj) = P(x/pj,pj-1) - (j-1)

where again pj has to be less than or equal to sqrt(x).

But notice that P(x,pj) is the full count of primes up to and including x, if pj is greater than or equal to the last prime less than sqrt(x), so I can remove all mention of primes with the following

dS(x,y) = (P(x/y,y-1) - P(y-1, sqrt(y-1)))(P(y, sqrt(y)) - P(y-1, sqrt(y-1)))

as if y is not prime then

P(y, sqrt(y)) - P(y-1, sqrt(y-1)) = 0

with the constraint that if y>sqrt(x), then P(x,y) = P(x,sqrt(x)) to keep the correct count.

I also now have

P(x,y) = [x] - S(x,y) - 1

and notice that dS(x,y) is the count of composites that have y as a factor that do not have primes less than y as a factor, which means that if y is composite dS(x,y) = 0, which is how I can remove mention of specific primes.

Now the count of composites for each prime less than or equal to the square root of x when added together just gives the full count of composites, so I have that the S function equals the sum of the dS functions for each prime less than or equal to sqrt(x), where I define S(x,1) = 0, and my prime counting function is complete.

Programming it is rather easy, and yes, it does work!

Though for speed the form where I have specific primes is much faster as otherwise you get recursion that determines that numbers are prime, over and over again, which slows it down.

As an exercise in pure thought, I doubt there are many derivations like it.

There is a surprise in the result in that I get a multi-dimensional prime counting function, which is P(x,y) which gives the same value as the traditional pi(x), if y=sqrt(x).

The other key fact is that dS(x,y) is a partial difference equation.

I came up with the gist of that derivation over three years ago.


James

Monday, June 13, 2005

3 Logic More Basics

In an earlier post I went over the necessity of three logical states, where you have 1 for true, -1 for false, but negatably true, and 0 for statements not negatably true.

To understand that system, consider the following.

One plus one equals two.

That sentence is true, but consider.

One plus one equals three.


That sentence is false, but negatably true, where by negation, I mean to negate one side of the equals:

One plus one does not equal three.

Or

One plus one is not three.


To show the last logical state is a little harder, as I need a nonsense statement like:

The sjdlfy is green.

Here I've created the word "sjdlfy" by randomly typing, so it's not meaningful to give it a color!

Under the rules of 3 Logic its logical value can be rigorously determined to be 0 by trying to negate it, which gives:

The sjdlfy is not green.

As that is still nonsense, it has a logical value of 0.

I'll talk again about the Liar Paradox, as it's a well-known example, where 3 Logic does not give a contradiction, but the resolution can be confusing I think, as consider the sentence:

This sentence is false.

It has a logical value of -1, as it is negatable:

This sentence is not false.

Notice then the logical result that a sentence cannot truthfully declare itself to be false, even if some other sentence can declare it to be false, as true does not equal false, T does not equal F.

So while I can say, that sentence is false, a sentence cannot truthfully claim that it is false, as it could only do so, if truth and falsity were equals, but they are not.

You may say to yourself, "The sentence claims it is false, and I can say, yes, that sentence is false, so then the sentence is true!"

But at the start you note that the sentence is false!

The contradiction is in your own behavior. If the sentence is false, then THAT sentence is false, so it's not true, no matter what. In claiming it is false, it is attempting to equate truth with falsity, which is just false.

One way to look at it is as if a clever con-man were trying to convince you to part with your life's wages. This con-man needs to convince you that true is false, so that you will give up your money, so he just tells you that, true is false, right?

Nope. That won't work. He tries something more clever, where you assume truth, like with sentences, as given a sentence there is an assumption of truth.

So in claiming itself to be false, a sentence is relying on your own inner assumptions about sentences, which you can consider.

Now consider this example:

A sentence normally declares a truth as the purpose of sentences is to communicate information, but THIS sentence is going to tell you that it is false, so it is telling you that it is not communicating truth to you, but is in fact, not true, as I go ahead and just now say, this sentence is false.

Now negate it:

A sentence normally declares a truth as the purpose of sentences is to communicate information, and THIS sentence is not going to tell you that it is false, so it is telling you that it IS communicating truth to you, which is in fact, true, as I go ahead and just now say, this sentence is true.

And I did have to negate in several places as it is a compound sentence, but I think you should have some sense of what is happening with the original statement:

This sentence is false.

It's like a con-man saying: "Trust me, truth is falsehood, give me your money."

But, truth is not falsehood. Invest wisely.


James

Wednesday, June 01, 2005

Three Valued Logic

In logic there is the usual bi-valued "logic" where everything is supposed to be either true or false, and there are three valued logics, where I did a quick search this morning and saw stuff like true, false, or unknown, among other possibilities, like using numbers where 1 is true, 1/2 is in-between, or unknown and 0 is false.

I'll make the case that three valued logic is a necessity.

I suggest a three valued logic, where a statement has a logical value of 1, 0, or -1, where 1 is true, -1 is false, and negatably true, while 0 is unresolvable.

For instance

1+1 equals 2

is a logical statement with a truth value of 1.

1+1 equals 3

is an illogical statement with a truth value of -1.

Notice it is negatable, to

1+1 does not equal 3

with a truth value of 1.

So the negative of a false statement i.e. a statement with a truth value of -1, is a true statement with a truth value of 1.

So what about 0?

Consider the statement:

If a=b and c=d then gooses lay eggs.

That statement cannot be said to be false and negatable, as the negative is, maybe,

If a does not equal b and c does not equal d then gooses do not lay eggs.

It remains nonsensical, despite negations where there are different ways you can negate.

So it has a truth value of 0.

Notice that in bi-valued systems the nonsensical statement can give you problems. Possibly some would just say it's false, but then again, it just doesn't make sense.

As "doesn't make sense" is not very rigorous, I like the term "malformed".

The statement is illogical as it is malformed.

The correct form in abstract is,

If a=b and b=c then a = c.

That has a truth value of 1.

Now let's consider a "paradox".

"This sentence is false."

Is an example of what I've seen called the "Liar's Paradox".

It has a truth value in the system I've outlined of -1.

So why?

"This sentence is not false."

is the negation, with a truth value of 1.

The sentence is negatable, so it has a truth value of -1.

No paradox.

That may have happened so fast that you may not realize how quickly this system just processed a "paradox" that has challenged logicians for quite some time, so here's a link:

http://www.iep.utm.edu/p/par-liar.htm

Now I emphasize three values in a system that can handle the "Liar Paradox" with only two, but that's because of malformed statements, which force you to have a formedness value.

So I see logic as about formedness, where a logical statement connects two truths, and it has a truth value of 1.

A false statement has a truth value of -1, and is negatable to a well-formed statement.

A statement that is not true nor can it be negated to a true statement is malformed with a truth value of 0.

If you disagree and believe that a bi-valued system can work, then you need to handle bizarre statements like:

"If the world were made of chocolate, and you were my friend, then robots would bleep like sheep."


Now then, in a two valued system, make sense of that statement!


James Harris