|
|
My friend posed the following question to me, that a friend of his was given in her math class:
Suppose in a simplified game of (American) football that the only possible amount of points one can score at a time are 3 or 7. What is the highest score that is impossible to achieve?
For example, 17 is a possible score (7 + 7 + 3) but 11 is not (there is no combination of 3's and 7's you can add together to get 11). Of course, since this is given in the context of a game, there can be no negative scores, so (7 + 7 - 3) doesn't work.
I wrote a small program to brute-force the solution, and searching up to 1000 I found the maximum impossible score is 11. However, I am not able to prove it. This problem reminds me of some things we did in Number Theory class but it's been a while and I've hence forgotten a lot of it.
Any pointers?
--
Marcus Kwok
|
|
|
|
|
It's trivial to show that the score can never be 11, so you now just have to prove that all numbers greater than 11 can be scored. All numbers after 11 fall into one of 3 series:
12 + 3n + 0 = {12, 15, 18, ...}
12 + 3n + 1 = 13 + 3n = {13, 16, 19, ...}
12 + 3n + 2 = 14 + 3n = {14, 17, 20, ...}
So, now just show that 12 (4 field goals), 13 (2 field goals and a touchdown), and 14 (2 touchdowns) can be scored, then all other numbers can be scored by tacking on more field goals (3n).
|
|
|
|
|
Fantastic! Thanks. Of course, now that I know the answer, it seems so obvious
--
Marcus Kwok
|
|
|
|
|
Anyone know of a way to take an inverse power to get the number a number was raised by?
x = 2^(20 - a) or x = 2^a
I need to determine a, but my math is way rusty. I think I need the nth root of x, but don't know how to write it, and actually need to find out what n is.
Do I need to do x^(1/a) = 2? I get stuck after that. Probably basic math, but it's slipped my brain.
Any help would be greatly appreciated.
Found this mildly funny: http://mathworld.wolfram.com/Power.html[^]
A number to the first power is, by definition, equal to itself, i.e., z^1==z.
It is therefore impressive that Captain Kirk (William Shatner) is able to detect one more heartbeat aboard the starship Enterprise than can be accounted for by amplifying an auditory sensor intensified by a factor of "1 to the fourth power" in the Season 1 Star Trek episode "Court Martial" (1967).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Hi,
x = 2^(20 - a) or x = 2^a
Use log
log x = (20 - a) * log 2 or log x = a * log 2
Regards
|
|
|
|
|
Thanks!
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
you can do this:
if x=n^a
then a=log(x)/log(n)
Log is the logarithm ( base 10 or naturals, this works whith any base )
Greetings
|
|
|
|
|
Hi, probably a better place for this, hopefully someone can help.
For one of my programs i'm trying to impliment my own version of the RSA algorithm, the encryption works fine, however the decrption does not, even though it uses basically the same algorithm. The code is as follows:
<br />
<br />
<br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include "math.h"<br />
<br />
<br />
int do_crypto(int M, int e, int N);<br />
<br />
int main()<br />
{<br />
<br />
printf("...\n");<br />
<br />
int p = 17;<br />
int q = 11;<br />
int e = 7;<br />
int N = p * q;
<br />
int M = 88;<br />
<br />
int C = do_crypto(M, e, N);
printf("C = %d \n", C);<br />
<br />
<br />
int d = ( ( (p-1) * (q-1) ) / e );<br />
printf("d = %d \n", d);<br />
<br />
<br />
int m = do_crypto(11, 23, 187);
printf("m = %d \n", m);<br />
<br />
<br />
return 0;<br />
}<br />
<br />
int do_crypto(int M, int e, int N)<br />
{<br />
int iret = int ( M * exp(e) ) % N;<br />
<br />
return iret;<br />
}<br />
<br />
When decrypting I have put in actual values for the keys etc, and the result should be 88.
The actual formulas are:
ENCRYPT: C = Me (Mod N)
DECRYPT: M = Cd (Mod N)
*** Please note the 'e' and 'd' are supposed to be superscript, e.g. raised to the power of...
|
|
|
|
|
Have you figured this out or still having trouble with it?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
i have a map that contain (22 * 18 ) images i don't want to add all of the images
i want have a 3 * 3 table
the problem is i want when user drag the map the images is load in the imagesboxes without user understand that all of the images dosn't load
How Can I do it(!!!!!)
MHF
|
|
|
|
|
Write a C program that accepts as input any of the following:
>> a listing of edges of a graph given as pairs of positive integers
>> the adjacency matrix
>> the incidence matrix
and outputs the other two...
|
|
|
|
|
robeelyn wrote:
Write a C program that accepts as input any of the following:
>> a listing of edges of a graph given as pairs of positive integers
>> the adjacency matrix
>> the incidence matrix
and outputs the other two...
What do you mean by this?
As of how to accomplish this, have you ever tried Google? Failing that try
|
|
|
|
|
Sounds like homework!
That's no moon, it's a space station. - Obi-wan Kenobi
|
|
|
|
|
|
|
1) you don't ask a regular english question
2) this looks like homework
3) you didn't even choose the right forum
|
|
|
|
|
Hi everyone,
does anyone know where I can find a visual basic 6 code for wavelet image compression and decomposition ... I need it for my graduation project ... Help please ...
Luay Al-wesi
|
|
|
|
|
|
Yeah .. I did try google ... and yahoo
Luay Al-wesi
|
|
|
|
|
|
yeah I did ... I get this "The page you requested cannot be found"
Luay Al-wesi
|
|
|
|
|
|
I tried that .. no codes for Visual Basic ... I do have the C code for it ... but I need the Visual Basic code .. thanks anyway
Luay Al-wesi
|
|
|
|
|
luay1985 wrote: I do have the C code for it ... but I need the Visual Basic code
Then port it from C to VB. Shouldn't be that difficult
That's no moon, it's a space station. - Obi-wan Kenobi
|
|
|
|