wu :: forums
« wu :: forums - A problem on remainders and quotients »

Welcome, Guest. Please Login or Register.
Nov 25th, 2024, 11:29am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   easy
(Moderators: william wu, Grimbal, Icarus, Eigenray, SMQ, towr, ThudnBlunder)
   A problem on remainders and quotients
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: A problem on remainders and quotients  (Read 732 times)
pcbouhid
Uberpuzzler
*****





   
Email

Gender: male
Posts: 647
A problem on remainders and quotients  
« on: Dec 13th, 2005, 10:26am »
Quote Quote Modify Modify

A number less than one million (1,000,000) is know to be such that diminishing it by 3 makes it divisible by 7. From the number diminished by 3 we subtract the seventh part. We then obtain a number that also becomes divisible by 7 after 3 is subtracted from it. From this number we derive another in the same way, namely by subtracting a seventh part from the number diminished by 3. This time, too, a number results that is divisible by 7 after subtracting 3. This occurs four more times, so that, in all, it happens seven times over, that a number is divisible by 7 after subtracting 3.
 
a) What is the number?
 
b) What is the number (that this time lies between 2,000,000 and 3,000,000) if the sixth number formed in the same way as before has the remainder of 5, instead of 3, when divided by 7?
« Last Edit: Jan 4th, 2006, 8:10am by pcbouhid » IP Logged

Don´t follow me, I´m lost too.
Dis
Newbie
*





   


Posts: 1
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #1 on: Dec 13th, 2005, 5:30pm »
Quote Quote Modify Modify

a) in Java:
 
class B {
 public static void main(String[] args) {
  xloop:
  for (int x=1; x < 1000000; x++) {
   int result = x;
   for (int cntr = 0; cntr < 7; cntr++) {
    if ((result-3)%7 != 0) continue xloop;
    result = 6*(result-3) / 7;
   }
   System.out.println("x is " + x);
}}}
« Last Edit: Dec 13th, 2005, 5:37pm by Dis » IP Logged
pcbouhid
Uberpuzzler
*****





   
Email

Gender: male
Posts: 647
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #2 on: Dec 13th, 2005, 6:11pm »
Quote Quote Modify Modify

? ? ? ?   Shocked
« Last Edit: Dec 13th, 2005, 6:12pm by pcbouhid » IP Logged

Don´t follow me, I´m lost too.
SMQ
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 2084
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #3 on: Dec 13th, 2005, 6:44pm »
Quote Quote Modify Modify

He said a) x is 823525 Grin
IP Logged

--SMQ

pcbouhid
Uberpuzzler
*****





   
Email

Gender: male
Posts: 647
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #4 on: Dec 14th, 2005, 4:50am »
Quote Quote Modify Modify

I wonder if it would be more easy to write 823,525. Grin
IP Logged

Don´t follow me, I´m lost too.
Grimbal
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 7527
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #5 on: Dec 14th, 2005, 6:20am »
Quote Quote Modify Modify

It could be if you don't have a compiler...
IP Logged
JohanC
Senior Riddler
****





   


Posts: 460
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #6 on: Dec 14th, 2005, 6:27am »
Quote Quote Modify Modify

What about
b) 2,705,909 ?
IP Logged
pcbouhid
Uberpuzzler
*****





   
Email

Gender: male
Posts: 647
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #7 on: Dec 14th, 2005, 7:21am »
Quote Quote Modify Modify

right, JC.
 
Talking about compilers: I have no knowledge in programming PC´s, using "C' or "C+", or whatever. As I said once, I´m from the time of Cobol, Assembler, Fortran, etc...
 
Anybody can direct me how to have in my computer  a compiler of the common languages used today? I´m always reading a program in a language that has no meaning to me, but I want to learn something about.
IP Logged

Don´t follow me, I´m lost too.
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #8 on: Dec 14th, 2005, 8:03am »
Quote Quote Modify Modify

You don't need a compiler per se.
If you have a browser, you can do small programs in javascript
open a new window/tab, and where you usually put the url, put  
 
javascript:document.write("hello world"); document.close();
 
voila, first program, easy as that.
 
But if you want to go for a grown-up language, under Linux you standard have gcc/g++, also javac if I'm not mistaken. For windows it's often a bit more work to get a free compiler.
« Last Edit: Dec 14th, 2005, 8:04am by towr » IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
JohanC
Senior Riddler
****





   


Posts: 460
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #9 on: Dec 14th, 2005, 9:22am »
Quote Quote Modify Modify

on Dec 14th, 2005, 7:21am, pcbouhid wrote:
Anybody can direct me how to have in my computer  a compiler of the common languages used today? I´m always reading a program in a language that has no meaning to me, but I want to learn something about.  

 
If your main goal is learning, and solving/checking some of your own mathematical puzzles, you'ld probably also interested in a program such as Pari-GP.
It can be downloaded (together with its manuals) for free at:
http://pari.math.u-bordeaux.fr/
 
You can either use it as a powerful calculator (including very large numbers, fractions, polyonomes, ...) or as a programming environment.
The syntax is quite similar to C, but more limited (I mean for programming; its much more extensive for mathematical stuff).
IP Logged
pcbouhid
Uberpuzzler
*****





   
Email

Gender: male
Posts: 647
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #10 on: Dec 14th, 2005, 11:20am »
Quote Quote Modify Modify

Tks towr and JC !! Shocked
IP Logged

Don´t follow me, I´m lost too.
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #11 on: Dec 14th, 2005, 1:50pm »
Quote Quote Modify Modify

If you like logic, you could also give Prolog a try (e.g. http://www.swi-prolog.org/). It's a logical programming language, and quite nice for some problems (I've used it a few times to solve puzzles on this board as well, so there should be a few examples around)
« Last Edit: Dec 14th, 2005, 1:51pm by towr » IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Icarus
wu::riddles Moderator
Uberpuzzler
*****



Boldly going where even angels fear to tread.

   


Gender: male
Posts: 4863
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #12 on: Dec 14th, 2005, 6:12pm »
Quote Quote Modify Modify

Since we are discussing languages... I have in the last couple of years finally come to grips with object-oriented languages, perforce with Visual Basic. The more I use it, however, the more I yearn for an object-oriented language wherein the objects are natural, the language is powerful, and the syntax was not dreamed up by some spastic with a hatred for all mankind.
 
I've had thoughts about how a language could be constructed in which all data types are objects, and all operators (including assignment) are methods. Such a language would interpret the expression "x = y" as "x.=(y)". I am curious if such a language has been developed.
 
So, does anyone know of such a language? Regardless of how far it goes in that direction, what is your favorite object-oriented language? And, most importantly, where can I obtain a free (i'm cheap), but legal, compiler for a Windows version?
IP Logged

"Pi goes on and on and on ...
And e is just as cursed.
I wonder: Which is larger
When their digits are reversed? " - Anonymous
Barukh
Uberpuzzler
*****






   


Gender: male
Posts: 2276
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #13 on: Dec 14th, 2005, 11:14pm »
Quote Quote Modify Modify

Icarus, I was told that Smalltalk is an ultimative object-oriented languange. At least, it has some of the features you wanted. See the  Wikipedia article for details and links.
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #14 on: Dec 15th, 2005, 12:38am »
Quote Quote Modify Modify

on Dec 14th, 2005, 6:12pm, Icarus wrote:
Such a language would interpret the expression "x = y" as "x.=(y)". I am curious if such a language has been developed.
That's generally how C++ does it. Although the simple types (int, bool etc) aren't generally regarded as classes, but you could wrap them up easily enough.
 
Quote:
what is your favorite object-oriented language?
Well, a few years ago I'd have said MOO, but I can't use that easily anymore. It is not in fact that great either, but it was convenient for small puzzles and such.
I suppose C++ is the only OO language I regularly work with at the moment. Although more often that not I forego the OO paradigm, since often not usefull for small programs.
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
JohanC
Senior Riddler
****





   


Posts: 460
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #15 on: Dec 15th, 2005, 2:52am »
Quote Quote Modify Modify

Lots of puzzlers seem to be very fond of Haskell, a functional language based on lambda calculus.
Does somebody here have hands-on experience?
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #16 on: Dec 15th, 2005, 3:53am »
Quote Quote Modify Modify

on Dec 15th, 2005, 2:52am, JohanC wrote:
Lots of puzzlers seem to be very fond of Haskell, a functional language based on lambda calculus.
Does somebody here have hands-on experience?
A little bit, but that was a long while ago. There's a chance I'll get better aquainted with it in a little while in the project I'm working on.  
LISP (and also Scheme) is an other lambda calculus based language. Not so popular for the main stream though, too many parentheses Wink
 
The benefits of functional, and also logical, languages over imperative and object oriented ones is that they often yield shorter and more elegant programs.
But it depends on what sort of problem you're dealing with. If you want to use iteration, it can get messy (because you often have to deal with it recursively).
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
rmsgrey
Uberpuzzler
*****





134688278 134688278   rmsgrey   rmsgrey


Gender: male
Posts: 2873
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #17 on: Dec 15th, 2005, 9:18am »
Quote Quote Modify Modify

For the computing course for my degree, I did some ML - writing code for it feels very natural to a trained mathematician...
IP Logged
Margit
Guest

Email

Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #18 on: Dec 16th, 2005, 12:33am »
Quote Quote Modify Modify Remove Remove

Icarus, You might like to check out Ruby -
www.ruby-lang.org
Quote from features -
"Ruby is a complete, full, pure object oriented language: OOL. This means all data in Ruby is an object, in the sense of Smalltalk: no exceptions. Example: In Ruby, the number 1 is an instance of class Fixnum."
 
 
Gcc has several frontend addons which normal Linux distros include and which may or may not be installed on your Linux system. Some of these are :
C++, D, ADA, Java, Pascal, Modula 2, Fortran etc.
 
 
For Win users who would like to use open source compilers and whatever else, check out :
www.cygwin.com
This gives you a Linux environment under Win.
IP Logged
pcbouhid
Uberpuzzler
*****





   
Email

Gender: male
Posts: 647
Re: A PROBLEM ON REMAINDERS AND QUOTIENTS  
« Reply #19 on: Dec 16th, 2005, 8:26am »
Quote Quote Modify Modify

Can I change the title to "A PROBLEM ON COMPILERS, LINUX AND WINDOWS?" Grin
IP Logged

Don´t follow me, I´m lost too.
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board