Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Asking for homework

0 views
Skip to first unread message

Geordie La Forge @ http://MeAmI.org

unread,
Oct 10, 2009, 11:04:36 PM10/10/09
to
Dear Sci.Math,

Would one of you be kind enough to offer up a particular problem or
subject I may research and respond to?

I am interesting in true to life practical applications of mathematics
as they relate to computation and practical matters and number theory,
but open to any creative challenge.

Thank you,

M. Michael Musatov
http://MeAmI.org

'Search. Complete.'

Bill

unread,
Oct 10, 2009, 11:24:55 PM10/10/09
to

"Geordie La Forge @ http://MeAmI.org" <marty....@gmail.com> wrote in
message
news:3a67b3b6-f8d6-4068...@k33g2000yqa.googlegroups.com...

> Dear Sci.Math,
>
> Would one of you be kind enough to offer up a particular problem or
> subject I may research and respond to?
>
> I am interesting in true to life practical applications of mathematics
> as they relate to computation and practical matters and number theory,
> but open to any creative challenge.

Have you mastered Suduko? Can you write a computer program to solve all
such puzzles?

Mensanator

unread,
Oct 10, 2009, 11:34:12 PM10/10/09
to
On Oct 10, 10:04�pm, "Geordie La Forge @ http://MeAmI.org"

<marty.musa...@gmail.com> wrote:
> Dear Sci.Math,
>
> Would one of you be kind enough to offer up a particular problem or
> subject I may research and respond to?
>
> I am interesting in true to life practical applications of mathematics
> as they relate to computation and practical matters and number theory,
> but open to any creative challenge.

In the 3n+C extension of the Collatz Conjecture, how long
is the loop-cycle if C = 2**94 - 3?

>
> Thank you,
>
> M. Michael Musatovhttp://MeAmI.org
>
> 'Search. Complete.'

Geopelia

unread,
Oct 11, 2009, 4:36:10 PM10/11/09
to

"Bill" <Bill_...@comcast.net> wrote in message
news:harj5...@news7.newsguy.com...

>
> "Geordie La Forge @ http://MeAmI.org" <marty....@gmail.com> wrote in
> message
> news:3a67b3b6-f8d6-4068...@k33g2000yqa.googlegroups.com...
>> Dear Sci.Math,
>>
>> Would one of you be kind enough to offer up a particular problem or
>> subject I may research and respond to?
>>
>> I am interesting in true to life practical applications of mathematics
>> as they relate to computation and practical matters and number theory,
>> but open to any creative challenge.
>
> Have you mastered Suduko? Can you write a computer program to solve all
> such puzzles?
>
>

Sudoku is meant to exercise the brain, not the computer.


http://alexslemonade.org

unread,
Oct 11, 2009, 6:16:04 PM10/11/09
to
Musatov wrote:
Geopelia wrote:
> "Bill" <Bill_...@comcast.net> wrote in message > news:harj5...@news7.newsguy.com...>>> "Geordie La Forge @ http://MeAmI.org". <marty....@gmail.com> wrote in > > message > > news:3a67b3b6-f8d6-4068...@k33g2000yqa.googlegroups.com...> >> Dear Sci.Math,> >>> >> Would one of you be kind enough to offer up a particular problem or> >> subject I may research and respond to?> >>> >> I am interesting in true to life practical applications of mathematics> >> as they relate to computation and practical matters and number theory,>>> but open to any creative challenge.> >> > Have you mastered Suduko?

Not yet!

Can you write a computer program to solve all > > such puzzles?> >>
>> > Sudoku is meant to exercise the brain, not the computer.

So true! Not to be a cryptic mystic reminscant of a 1980's Martial
Arts Film, but you might say, 'Master the brain before master the
computer!"

Here is what we have: (work in progress)
*****************
[puzzle2.c]
*****************
http://meami.org
###################
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>


/* function Declarations */
int input_soduku( char* );
void print_soduku();
int solve_soduku( int );
int is_valid_soduku ( int );


/* Variables (Global) */
int soduku[81];
unsigned long int number_asks;
int list_of_empty_squares[81];

int main(int argc, char* argv[])
{

int i;
if (argc !=2)
{
printf("Enter the soduku as the second argument.\n");
return EXIT_FAILURE;
}

i = input_soduku(argv[1]);
if (!i) return EXIT_FAILURE;

number_tries = 0;

/*for(i=0; i<81; i++) printf("%d\t", list_of_empty_squares[i]);*/

i = solve_soduku(0);
if (!i)
{
printf("Hmmm... If there is a solution to this sudoku puzzle it may be
too hard for me.\n");
return EXIT_FAILURE;
}

printf("\nAwesome. Here is the solution to your Soduku!\n");
print_soduku();

printf("It took me %lu educated guesses. I'm sleepy, now. You?!\n",
number_tries);
fflush(stdout);


return EXIT_SUCCESS;
}


int is_valid_soduku (int index)
{
int i, j, k, m, n;
i = soduku[index];

/*Is the column index in?*/
for (j = index % 9; j<81; j+=9)
{
if ( (soduku[j] == i) && (j!=index) )
{
/*printf("Error:1 %d %d %d\t", index, i, j);*/
return 0;
}
}

/*is the row index in?*/
k= (index/9 + 1)*9;
for (j = (index/9)*9; j<k; j++)
{
if ( (soduku[j] == i) && (j!=index) )
{
/*printf("Error:2 %d %d %d\t", index, i, j);*/
return 0;
}
}

/*is the grid index in?*/
j= (index / 9)/3 *3;
k = (index % 9)/3 *3;
for ( m= j+2; m>=j; m--)
{
for ( n=k+2; n>=k; n--)
{
if ( (soduku[n*9+m] == i) && ((n*9+m)!=index) )
{
/*printf("Error:3 %d %d %d\t", index, i, n*9+m);*/
return 0;
}
}
}
return 1;

}

int solve_soduku(int index)
{
int new_value, empty_square;
empty_square= list_of_empty_squares[index];

if (empty_square == -1) return 1;

for( new_value=1; new_value<=9; new_value++)
{
soduku[ empty_square ] = new_value;

if ( is_valid_soduku(empty_square) )
{
number_tries++;
printf("1");
printf("%d fits in %d\t", new_value, empty_square);

if ( solve_soduku( index+1) ) return 1;
}

}
printf("Nothing fits in %d.\t", empty_square);
soduku[empty_square] = 0;
return 0;

}

void print_soduku()
{
int i, j, k;

for (i=0; i< 81; i++) {
j = i%9;
k = i/9;

if (!j)
{
printf("\n");
if ( (k==3) || (k==6) ) printf("-------------------\n");
}

if ( (j==3) || (j==6) ) printf("|");

if(soduku[i] == 0 )
{
printf( " ");
}
else
{
printf("%d ", soduku[i]);
}


}
printf("\n");
fflush(stdout);
}

int input_soduku( char* file)
{
FILE* inputSoduku;
int i;
int input;
int j=0;

inputSoduku = fopen( file ,"r");
if (!inputSoduku)
{
printf("Could not open Soduku. Let's make sure we have the soduku in
order and try again.\n");
return 0;
}

for (i=0; i< 81; i++)
{
do
{
input = fgetc( inputSoduku );
if (input == EOF)
{
printf("We have reached the end of the file before we've gotten all\n"
"our numbers. Please make sure we have the file in order.\n");
return 0;
}
} while (input<'0' || input>'9');

soduku[i] = input-'0';
if (input == '0')
{
list_of_empty_squares[j++] = i;
}
}

fclose( inputSoduku);
list_of_empty_squares[j] = -1;
printf("The soduku in %s follows.\n", file);

print_soduku();

printf("We are computing the solution. Wait please....\n");

return 1;

http://alexslemonade.org

unread,
Oct 11, 2009, 6:36:22 PM10/11/09
to
Musatov wrote:
Mensanator wrote:> On Oct 10, 10:04�pm, "Geordie La Forge @ http://MeAmI.org">.

<marty.musa...@gmail.com> wrote:> > Dear Sci.Math,> >> > Would one of
you be kind enough to offer up a particular problem or> > subject I
may research and respond to?> >> > I am interesting in true to life
practical applications of mathematics> > as they relate to computation
and practical matters and number theory,>> but open to any creative
challenge.>> In the 3n+C extension of the Collatz Conjecture, how
long> is the loop-cycle if C = 2**94 - 3?> > >> >

This is what I found:

/
//
/
/

Thank you,> >> > M. Michael Musatov http://MeAmI.org. >>>> 'Search.
Complete.'

Mensanator

unread,
Oct 11, 2009, 7:26:36 PM10/11/09
to
On Oct 11, 5:36�pm, "http://alexslemonade.org"
<marty.musa...@gmail.com> wrote:
> Musatov wrote:
> Mensanator wrote:> On Oct 10, 10:04 pm, "Geordie La Forge @http://MeAmI.org">.

> <marty.musa...@gmail.com> wrote:> > Dear Sci.Math,> >> > Would one of
>
> you be kind enough to offer up a particular problem or> > subject I
> may research and respond to?> >> > I am interesting in true to life
> practical applications of mathematics> > as they relate to computation
> and practical matters and number theory,>> but open to any creative
> challenge.>> In the 3n+C extension of the Collatz Conjecture, how
> long> is the loop-cycle if C = 2**94 - 3?> > >> >
>
> This is what I found:
>
> /
> //
> /
> /

"Fat, drunk and stupid is no way to go through
life, son." -- Dean Wormer, Animal House

>
> Thank you,> >> > M. Michael Musatovhttp://MeAmI.org. �>>>> 'Search.
> Complete.'

Geopelia

unread,
Oct 11, 2009, 10:24:01 PM10/11/09
to

"http://alexslemonade.org" <marty....@gmail.com> wrote in message
news:497ea263-17de-4f34...@l9g2000yqi.googlegroups.com...

Not yet!


(Rest snipped for length)

It might help to spell it Sudoku.

Now try it with Code Cracker. That's my favourite.


Bill

unread,
Oct 12, 2009, 12:14:06 AM10/12/09
to

"http://alexslemonade.org" <marty....@gmail.com> wrote in message
news:497ea263-17de-4f34...@l9g2000yqi.googlegroups.com...

Musatov wrote:
Geopelia wrote:
> "Bill" <Bill_...@comcast.net> wrote in message >
> news:harj5...@news7.newsguy.com...>>> "Geordie La Forge @
> http://MeAmI.org". <marty....@gmail.com> wrote in > > message > >
> news:3a67b3b6-f8d6-4068...@k33g2000yqa.googlegroups.com...>
> >> Dear Sci.Math,> >>> >> Would one of you be kind enough to offer up a
> particular problem or> >> subject I may research and respond to?> >>> >> I
> am interesting in true to life practical applications of mathematics> >>
> as they relate to computation and practical matters and number theory,>>>
> but open to any creative challenge.> >> > Have you mastered Suduko?

Not yet!

Can you write a computer program to solve all > > such puzzles?> >>
>> > Sudoku is meant to exercise the brain, not the computer.

So true! Not to be a cryptic mystic reminscant of a 1980's Martial
Arts Film, but you might say, 'Master the brain before master the
computer!"

Here is what we have: (work in progress)

Why don't you just provide an algorithm?


Musatov

unread,
Oct 12, 2009, 1:36:48 AM10/12/09
to
Musatov wrote:
Why does it not matter if I intentionally spelled Sodoku as 'soduku'in
my code to make it work?

An idiot is one who dismissed knowledge or understanding under
prejudice of their own judgment imposed upon others.
--M.Michael Musatov

BruceS

unread,
Nov 12, 2009, 5:41:03 PM11/12/09
to
On Oct 10, 8:24 pm, "Bill" <Bill_NOS...@comcast.net> wrote:
> "Geordie La Forge @http://MeAmI.org" <marty.musa...@gmail.com> wrote in
> messagenews:3a67b3b6-f8d6-4068...@k33g2000yqa.googlegroups.com...

>
> > Dear Sci.Math,
>
> > Would one of you be kind enough to offer up a particular problem or
> > subject I may research and respond to?
>
> > I am interesting in true to life practical applications of mathematics
> > as they relate to computation and practical matters and number theory,
> > but open to any creative challenge.
>
> Have you mastered Suduko?  Can you write a computer program to solve all
> such puzzles?

For my part, the answer to both questions is "yes". There's another,
related question to which I would have to answer differently.

0 new messages