Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Simple simple program error...please help

Reply
Thread Tools

Simple simple program error...please help

 
 
toy
Guest
Posts: n/a
 
      11-01-2005
@alf what do you mean?

I understood because I have prior knowledge and familiarity with
Euclid's algorithm..and his explanation was very clear and concise.

why do you ask?

 
Reply With Quote
 
 
 
 
Neo
Guest
Posts: n/a
 
      11-01-2005
"toy" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) ups.com:

>
>
>
>


Euclid's Algo?? Which one.?
Neo

--
 
Reply With Quote
 
 
 
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      11-01-2005
Alf P. Steinbach wrote:

> * Kai-Uwe Bux:
>>
>> [relevant info, gcd]
>>
>> These ideas should get you started.

>
> Just tell me how you saw what he was trying to do?
>
> Even if it's off-topic.
>


Easy: the following line from the original post gives it away:

I am trying to find integers where 65537i + 3551j = 1

What follows is code that clearly tries a brute force attack to find i and
j. After fixing, the relevant portion looks like so:

for (long i=0; i<65537; i++) {
for (long j=0; j<3511; j++) {
{
x=65337 * i + 3511 * j;
if (x==1) {
cout <<"i: "<< i << " j: "<< j<< endl;
}

}}



Best

Kai-Uwe Bux
 
Reply With Quote
 
makc.the.great@gmail.com
Guest
Posts: n/a
 
      11-01-2005

Kai-Uwe Bux wrote:
> Alf P. Steinbach wrote:
>
> > * Kai-Uwe Bux:
> >>
> >> [relevant info, gcd]
> >>
> >> These ideas should get you started.

> >
> > Just tell me how you saw what he was trying to do?
> >
> > Even if it's off-topic.
> >

>
> Easy: the following line from the original post gives it away:
>
> I am trying to find integers where 65537i + 3551j = 1
>
> What follows is code that clearly tries a brute force attack to find i and
> j. After fixing, the relevant portion looks like so:
>
> for (long i=0; i<65537; i++) {
> for (long j=0; j<3511; j++) {
> {
> x=65337 * i + 3511 * j;
> if (x==1) {
> cout <<"i: "<< i << " j: "<< j<< endl;
> }
>
> }}
>


Don't you think he should include some negative integers as well, or he
might waste computer resources for nothing.

hint: neither (0,1) nor (1,0) doesn't work, so...

 
Reply With Quote
 
Karl Heinz Buchegger
Guest
Posts: n/a
 
      11-02-2005
toy wrote:
>
> @alf what do you mean?
>
> I understood because I have prior knowledge and familiarity with
> Euclid's algorithm..and his explanation was very clear and concise.
>
> why do you ask?


I guess because this looks like a homework assignment in basic
loop handling. And for that, a teacher is not happy with a solution
based on euclids algorithm (probably because a newbie is not able
to write one on his own).

--
Karl Heinz Buchegger
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple program with a simple(?) error -- what's wrong? RichardOnRails Ruby 3 07-21-2008 01:26 PM
looking for a simple way to load a program from another python program.. Eric_Dexter@msn.com Python 10 08-15-2006 05:00 AM
Help !I want to write a program to count the running time of another program freehomesp@yahoo.com.cn C Programming 1 08-12-2005 06:13 AM
A few simple problems in a simple program. jmac@berkeley.edu C Programming 7 07-23-2003 09:51 PM
passing data between Java program and C program--help pipi Java 1 07-21-2003 05:02 AM



Advertisments