int GetNumber() {

int i=1, n=1; bool r=false;

for (;!r;){if(i%n==(n-1)){n=n%11+1;r=n==11;}else{i++;n=1;}}return i;}

**Edited by Duh Puck, 15 February 2008 - 06:51 PM.**

Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account. As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends. Of course, you can also enjoy our collection of amazing optical illusions and cool math games. If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top. If you have a website, we would appreciate a little link to BrainDen. Thanks and enjoy the Den :-) |

Guest Message by DevFuse

Started by bonanova, Sep 19 2007 08:47 AM

Best Answer normdeplume , 19 September 2007 - 07:23 PM

My answer is below, is this the answer you were looking for or is there a lower one?

Spoiler for solution

Just because your voice reaches halfway around the world doesn't mean you are wiser than when it reached only to the end of the bar. Go to the full post

67 replies to this topic

Posted 15 February 2008 - 06:50 PM

In the spirit of ATL, I present to you my method, in C#, for calculating the answer by brute force, without taking into account LCM's. I'm curious how much smaller this could be done.

int GetNumber() {

int i=1, n=1; bool r=false;

for (;!r;){if(i%n==(n-1)){n=n%11+1;r=n==11;}else{i++;n=1;}}return i;}

int GetNumber() {

int i=1, n=1; bool r=false;

for (;!r;){if(i%n==(n-1)){n=n%11+1;r=n==11;}else{i++;n=1;}}return i;}

**Edited by Duh Puck, 15 February 2008 - 06:51 PM.**

Posted 09 March 2008 - 02:39 AM

I think you should include dividing 11 to get a remainder of 10 and dividing 12 to get a remainder of 11I just found a number with an interesting property:

When I divide it by 2, the remainder is 1.

When I divide it by 3, the remainder is 2.

When I divide it by 4, the remainder is 3.

When I divide it by 5, the remainder is 4.

When I divide it by 6, the remainder is 5.

When I divide it by 7, the remainder is 6.

When I divide it by 8, the remainder is 7.

When I divide it by 9, the remainder is 8.

When I divide it by 10, the remainder is 9.

It's not a small number, but it's not really big, either.

When I looked for a smaller number with this property I couldn't find one.

Can you find it?

Posted 09 March 2008 - 06:03 AM

It's the least common multiple of 2, 3, 4, 5, 6, 7, 8, 9, and 10, then minus one, which is 2x2x2x3x3x5x7 minus one, which is 2519.

**Edited by babbal, 09 March 2008 - 06:04 AM.**

Posted 17 March 2008 - 11:55 PM

wrote a simple script - the smallest number is 2519.

here is my way.

$solution = "F";

$x=0;

while($solution eq "F")

{

$x++;

$flag=0;

for($i=1;$i<10;$i++)

{

$j=$i+1;

$y=$x%$j;

if($y != $i)

{$flag=1;}

}

if($flag==0)

{

$solution="T";

print $x,"\n";

}

}

## it is perl.

Do people actually use perl? I never have..

In the spirit of ATL, I present to you my method, in C#, for calculating the answer by brute force, without taking into account LCM's. I'm curious how much smaller this could be done.

int GetNumber() {

int i=1, n=1; bool r=false;

for (;!r;){if(i%n==(n-1)){n=n%11+1;r=n==11;}else{i++;n=1;}}return i;}

Well, that is shorter code than mine would be, but mine would be done sooner. I don't feel like writing it, but I could do it! I am actually kinda disappointed in myself for not realizing it was a LCM problem... when I was thinking about it in my head, I was considering each sentence seperately and finding a rule for each one. First there was no even numbers allowed (2:1), then the last digit had to be a 9 (10:9), then the second to last digit had to be one less than 3, 6, or 9 (3:2), etc. I came up with 5039 this way... (5039+1)/2 - 1 = 2519, go figure

Posted 18 March 2008 - 03:39 PM

I really enjoyed this one, as it pressed my math brain a little to figure out the best way to solve it. Alas, I believe I found the answer (assuming it must be positive, of course) ...

Spoiler for Math and Excel are my friend

Posted 18 March 2008 - 04:05 PM

Another variation of the above problem is as follows:

I just found a number with an interesting property:

When I divide it by 2, the remainder is 1.

When I divide it by 3, the remainder is 1.

When I divide it by 4, the remainder is 1.

When I divide it by 5, the remainder is 1.

When I divide it by 6, the remainder is 1.

When I divide it by 7, the remainder is 1.

When I divide it by 8, the remainder is 1.

When I divide it by 9, the remainder is 1.

When I divide it by 10, the remainder is 1.

But when I divide it by 11, the remainder is 0 (just to make the procedure a little bit different).

Can you find it?

Spoiler for Solution of variation

Posted 18 March 2008 - 04:24 PM

Nope ... 2521 is not divisible by 11.Spoiler for Solution of variation

Posted 18 March 2008 - 06:05 PM

New solutionNope ... 2521 is not divisible by 11.

Spoiler for 2nd try

**Edited by imran, 18 March 2008 - 06:06 PM.**

Posted 18 March 2008 - 06:46 PM

New solution

Spoiler for 2nd try

that is correct. good job ... I just managed to do it the brute forth method.

Posted 26 April 2008 - 11:33 PM

How can the answer be......

Spoiler for ?

0 members, 0 guests, 0 anonymous users