Wikipedia:Reference desk/Archives/Mathematics/2007 September 30

= September 30 =

N-th power Legendre Symbol of an integer mod integer (Java)
I was wondering if there was java code somewhere on the internet that deals with this problem. I looked everywhere but could not find any.

Suppose you have a number n mod p, where n is an integer and p is prime, then if Legendre Symbol is = 1 there is a solution such that x^2 = n mod p, if Legendre Symbol is = 0 then n has a factor in common with p, if Legendre Symbol is -1 there there is no solution for X such that X^2=n mod p.

This problem is trivial with the case of a prime mod and a power of 2 because of the Euler's criterion.

The terms that will help with this question are: Jacobi Symbol,Quadratic Residue,Euler's criterion, Legendre Symbol,P-adics,ect... Number theory stuff basically....

Here is what I wanted the program to do: Given (not specifically prime) integer A, B, C This function outputs integers {-1,0,1}, -1 is false, 0 is N/A, 1 is true

Checks that A mod C is congruent to X^B mod C, but does "not" give the value of X. The variable "B" is not just 2 but can be any prime integer.

It would be really helpful if you can provide be to some source code to something that does something similar. 24.250.139.137 14:11, 30 September 2007 (UTC)ForgotMyLogin —Preceding unsigned comment added by 24.250.139.137 (talk) 14:08, 30 September 2007 (UTC)

It's homework, but I need help!
I have a test on Monday and I'm doing my review for it. I'm not able to go in to the class for tutorials befopre the test so I need some help with solving a couple problems I don't know how to do.


 * 1) (3) Write $$f(x) = x^3 - 6x^2 + 12x - 5$$ in the form $$f(x) = (x-k)q(x)+r$$ when $$k = 3$$
 * 2) (4) Write the quadratic function, $$f(x) = 2x^2 + 8x + 17 $$, in standard form. THen find the vertex, axis of symmetry, and x-intercepts. (on this problem I think I remember soemthign about (-h,k) or something)
 * 3) (19) A rectangular field has a perimeter of 306 feet and is to have an area at least 5670 square feet. Within what bounds must the length, x, of the rectangular field lie?
 * 4) (26) Solve: $$x^2-5x-24<0$$ (do I jsut factor and the answer is $$(x+3)(x-8)$$?)
 * 5) (27) Solve: $$ 4.1x^2 - 7.1 < -3.1x$$
 * 6) (20) Find the domain and range of the function. $$q(x) = (3x)/(x+8)$$
 * 7) (21) Find the domain of the function. $$f(w) = sqrt(25-w^2)$$ (i don't know how to do the square root symbol, but sqrt is square root)

I can't explain how much it helps for anyone on this desk to help me with these problems. Myt grade i nthe class rides on this test and if I get less than an 80 on the test, I will be barred from any extracurricular activities. These are only 7 of the 50 problems so I pretty much got it down but these are the hardest ones for me. Thank so SO MUCH!! edit: didn't sign in before savign the page: schyler 17:16, 30 September 2007 (UTC)


 * Do your own homework. The reference desk will not give you answers for your homework, although we will try to help you out if there is a specific part of your homework you do not understand. Make an effort to show that you have tried solving it first. —David Eppstein 17:18, 30 September 2007 (UTC)


 * Schyler, you're more likely to get help if you put your questions in a more abstract form; that at least shows us that you understand what kind of problem you're dealing with. If you've got this far in your course without being able to that, what do you expect us to do?  &mdash;Tamfang 19:46, 30 September 2007 (UTC)

[Personal attacks removed] schyler 17:19, 30 September 2007 (UTC)


 * Please be WP:CIVIL. —David Eppstein 17:20, 30 September 2007 (UTC)


 * Oh, I wouldn't have removed the entire whine. &mdash;Tamfang 19:46, 30 September 2007 (UTC)


 * I've restored the questions themselves (trimmed down in presentation) for context. I see what might have provoked you, Schyler, but profanity and namecalling are unacceptable behavior.
 * You need to understand both the rules of the page and the attitude of the people who help here. Many of us are teachers, and are more than willing to help you understand a problem and how to solve it. We will not solve homework problems for you, and don't appreciate being asked.
 * Your plea lies in a gray area, but I believe most of us would agree with David Eppstein that it asks for too much and demonstrates too little. Here's why.
 * Question (26) is well presented, because it shows us that you have thought about the problem and are left with a specific uncertainty, which you tell us. But for all the others, what can we say? We don't know what has been taught so far in your class, we don't know what puzzles you about the questions, we don't know what (if anything) you have tried.
 * And your heartrending saga about being barred from extracurricular activities falls on battle-toughened hearts. What would a soccer coach say to a player who did not work hard at practice but then expected to be in the game? Any good teacher will try to help a student who demonstates commitment; so far, that's not you. --KSmrqT 20:57, 30 September 2007 (UTC)


 * Since you have made an effort on number 26, I will help you solve it:

(26) Solve: $$x^2-5x-24<0$$ (do I jsut factor and the answer is $$(x+3)(x-8)$$?


 * The factoring was a good first step. Next, to get an answer less than 0 (or, in other words, negative) you must make one factor negative and one positive.  This is because a positive times a positive is positive, and a negative times a negative is also positive.  We can only get a negative value by multiplying a positive by a negative.  So, let's make a chart:

x x+3  x-8 -- ---  ---  9   12    1  8   11    0  7   10   -1  6    9   -2  5    8   -3  4    7   -4  3    6   -5  2    5   -6  1    4   -7  0    3   -8 -1    2   -9 -2    1  -10 -3    0  -11 -4   -1  -12 -5   -2  -13 -6   -3  -14


 * Now, you can see from this chart that we only have one positive and one negative factor if x is between -3 and 8. Do exactly -3 and 8 work ?  Let's try them in the original equation:

x^2 - 5x   - 24 < 0 (-3)^2 - 5(-3) - 24 < 0      9 - (-15) - 24 < 0       9 +   15  - 24 < 0                    0 < 0

x^2 - 5x  - 24 < 0 8^2 - 5(8) - 24 < 0  64 - 40   - 24 < 0                0 < 0


 * So no, the values of -3 and 8 would only work if the original equation was: x^2 - 5x - 24 ≤ 0. Thus, we get an answer of -3 < x < 8, instead of -3 ≤ x ≤ 8.  Now let's try a value that should work, x = 0:

x^2 - 5x  - 24 < 0 0^2 - 5(0) - 24 < 0   0 - 0    - 24 < 0              -24 < 0

It does work, good. Now try two that shouldn't work (9 and -4):

x^2 - 5x  - 24 < 0 9^2 - 5(9) - 24 < 0  81 - 45   - 24 < 0               12 < 0

x^2 - 5x   - 24 < 0 (-4)^2 - 5(-4) - 24 < 0     16 - (-20) - 24 < 0      16 +   20  - 24 < 0                   12 < 0


 * They don't work, good. So, we have verified our answer.  A much quicker way to solve this would be with a graphing calculator, but I'm guessing you haven't gotten that far yet. StuRat 23:29, 30 September 2007 (UTC)


 * I'm feeling generous, so will also show you the setup for problem 19:

(19) A rectangular field has a perimeter of 306 feet and is to have an area at least 5670 square feet. Within what bounds must the length, x, of the rectangular field lie?


 * The formula for the perimeter of a rectangle is twice the height plus twice the length equals the perimeter. Since they said to use x for the length, let's use y for the height, to get:

2x + 2y = 306


 * Now solve for y:

2y = 306 - 2x

y = 153 - x


 * The formula for the area of a rectangle is height times length, or xy, in our case. This gives us:

xy ≥ 5670


 * Now plug in the value for y we calculated in terms of x previously:

x(153 - x) ≥ 5670


 * Now solve for x:

153x - x^2 ≥ 5670

-x^2 + 153x - 5670 ≥ 0

(-x + 63)(x - 90) ≥ 0

(63 - x)(x - 90) ≥ 0


 * Now you have it just like the previous problem I showed you, except that you are looking for a positive or zero value on the left. This means the two factors must either both be positive (or zero) or both negative (or zero).  See if you can solve it from there.  Hint: You don't need to chart every integer, just look at those around x = 63 and x = 90:

x 63-x x-90 --   91 90 89  .  .  . 64 63 62


 * Let me know if you need more help with this problem.StuRat 00:24, 1 October 2007 (UTC)

Some hints for problems that I don't think have been covered by anyone else yet: (3) Notice that writing "f = aq + r" is saying that "f equals a times q, plus r", which is equivalent to "f divided by a gives q, remainder r". So, you should be able to perform polynomial long division to get the answer, or, as I suspect you would have been taught about, the polynomial remainder theorem. (4) I assume from the context that "standard form" is y = a(x-h)^2 + k. Can you write it like that? Does that give you anything that can be used to find the vertex, etc.? (19), (26) and (27) are all of the same form, but arranged differently. In each case, you can write it as (quadratic function) > 0, and solve in a fashion similar to StuRat's hints above.

Again, more specifics on how far you got with each question will help us know how much we can help you. Confusing Manifestation 23:40, 1 October 2007 (UTC)

to the power of negative?
What's ten to the power of negative one, two, three etc. and how do you figure it out? (Wookiemaster 17:29, 30 September 2007 (UTC))


 * 10-1 = 1/10, 10-2 = 1/100, 10-3 = 1/1000, and so on. Exponent has the full rule.  The reason negative exponents are defined this way is so the formulas in Exponent hold true. --Ben Kovitz 17:37, 30 September 2007 (UTC)

Thank you very much but can I get the answer in decimals(Wookiemaster 17:40, 30 September 2007 (UTC))

"What's ten to the power of negative one, two, three etc." 0.1      0.01      0.001      24.250.139.137 17:47, 30 September 2007 (UTC)ForgotMyLogin


 * Thank you very much but can I get the answer in decimals? In the old days, you do long division. Nowadays kids just punch it into their calculators and get a decimal answer. Does this answer your question? It would be much much better if you understand the basic concept of division (mathematics). 202.168.50.40 23:36, 30 September 2007 (UTC)


 * In the old days you punched it into your pocket calculator. Nowadays kids just go to Wikipedia.  —Blotwell 05:22, 1 October 2007 (UTC)


 * Or (for those with really big pockets) Google AndrewWTaylor 08:02, 1 October 2007 (UTC)

Dividing decimals?
I know that when dividing decimals you have to move the decimal to the right as many times as you have to for it to become a whole number.Ex. (4.56 divided into 0.8) becomes (45.6 divided into 8) My question is "when we get the answer do we put the decimal back where it was or do we leave it wher we put it? (Wookiemaster 17:53, 30 September 2007 (UTC))


 * I haven't heard of that method of dividing decimals. If I understand the method correctly, then you would leave the decimal where you put it.  Better, though, would be to try both ways yourself on a few examples where you already know the answer.  Then the right way will become clear. Ben Kovitz 18:48, 30 September 2007 (UTC)


 * Let us try mathematics rather than folklore. The number 45.6 is 10×4.56, yes? Likewise 8 =10×0.8. Now compare 0.8&frasl;4.56 to what you propose:
 * $$ \frac{10 \times 0.8}{10 \times 4.56} = \frac{8}{45.6} . \,\!$$
 * This works, but I, too, find it a puzzling and unnecessary distraction. --KSmrqT 20:10, 30 September 2007 (UTC)

What is the density of triangular-free numbers?
What I mean is: What's the density of natural numbers that fail to be divisible by 3,6,10,15,21,..n(n+1)/2..? (I left out divisibility by the triangular number 1, by necessity, just as it must be left out for squarefree numbers) It's well known that the square-frees have density 6/pi^2, so I would find it fascinating to know, if a density formula for triangular-frees exists, whether it explicitly involves pi. Thanks, Rich Peterson —Preceding unsigned comment added by 130.86.14.86 (talk) 21:34, 30 September 2007 (UTC)


 * I don't know, but the sequence itself is in the Online Encyclopedia of Integer Sequences as A112886. —David Eppstein 21:53, 30 September 2007 (UTC)


 * I ran some code in R to find the triangular-free numbers up to 100,000 and show their distribution, and the density does seem to converge to something resembling 2/3 (in fact, there are 66,666 triangular-free numbers in the range). Of course this doesn't prove anything, but it does look like a promising result, especially since it's such a fast convergence (see below graphs, where the first is on normal axes and the second is semilog). Confusing Manifestation 06:30, 2 October 2007 (UTC)


 * But doesn't the density have to be less than 2/3 because we eliminate straight away 1/3 of integers which are divisble by 3 ? This also eliminates numbers divisible by 6, but after that we also have to eliminate those numbers divisible by 10. This gives an upper limit on the density of (2/3)x(9/10) or 0.6. Gandalf61 15:50, 2 October 2007 (UTC)


 * I've looked at this again, and I only get 55,622 triangular free numbers in the first 100,000 numbers. I looked at it in blocks of 5000 integers, and the lowest was 2774 (twice), highest was 2788. The density in each of the 20 blocks of 5000 seemed fairly constant - with some noise. As Gandalf points out, there are 66,667 numbers not divisible by 3 in the first 100,000, so putting in the fact that 10 and 20 are triangular-free, must mean that the answer is less than 66,666 as you mentioned. Richard B 17:24, 2 October 2007 (UTC)


 * OK, I obviously used a dumb choice of method that gave me completely wrong answers (actually, it was pretty much knocking off only the multiples of 3), but if you look above I've uploaded new, apparently more correct versions, which still seem to get close to some kind of value around 0.56. I also changed it to cover values up to 10,000,000, and took off some values from the start which skewed the axes. Confusing Manifestation 02:17, 3 October 2007 (UTC)