Free Range Code wrangling
Author |
Message |
Cervantes

|
Posted: Sun May 21, 2006 4:41 pm Post subject: (No subject) |
|
|
Cornflake wrote: #3 has been changed slightly; 3^(1/3) cannot be one of the number. Both numbers must be unique.
There's still an infinite number of solutions, though.
Sorry, no mod powers here.  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
rizzix
|
Posted: Sun May 21, 2006 4:42 pm Post subject: (No subject) |
|
|
indeed.
PS: fixed it btw.  |
|
|
|
|
 |
md

|
Posted: Sun May 21, 2006 4:47 pm Post subject: (No subject) |
|
|
Bah, where is a powerful mod when needed?
The Bonus question is now #3; as the original #3 was apparently more trivial then I thought.
A new bonus question will be psoted later tonight. Sorry to anyone who was writing #3. |
|
|
|
|
 |
bugzpodder

|
Posted: Sun May 21, 2006 6:05 pm Post subject: (No subject) |
|
|
Cervantes wrote: Cornflake wrote: #3 has been changed slightly; 3^(1/3) cannot be one of the number. Both numbers must be unique.
There's still an infinite number of solutions, though.
Sorry, no mod powers here. 
there was no calculations involved, and plus you cannot output infinitely many decimal digits, plus every questions uses the word "numbers" yet the meaning is different, whether it be integer, positive integer, or reals like in this case.
I think project euler (see link i've posted) is a better set of problems than these. |
|
|
|
|
 |
md

|
Posted: Sun May 21, 2006 10:14 pm Post subject: (No subject) |
|
|
bugzpodder wrote:
there was no calculations involved, and plus you cannot output infinitely many decimal digits, plus every questions uses the word "numbers" yet the meaning is different, whether it be integer, positive integer, or reals like in this case.
I think project euler (see link i've posted) is a better set of problems than these.
Lookit! Quit ragging on my questions! If they are so easy then write them! There may be other better challenges out there... but this one has $10 attached to it
On an unrelated note... the bonus question shall be posted eventually; but tonight and tomorrow day my time is owned by my employer, so I won't have time to find a question until after that. |
|
|
|
|
 |
codemage

|
Posted: Tue May 23, 2006 8:50 am Post subject: (No subject) |
|
|
If you ask me, this seems like another elaborate scheme for Cornflake to get us to do his homework for him. Perhaps you should explain the nature of this "contest" and if it's for an "experimental class" and who your "teacher's" name is.
For the last time, Cornflake. Do your own work. There are some excellent tutorial sections here for you to learn how to solve these problems the honest way.
 |
|
|
|
|
 |
zylum

|
Posted: Tue May 23, 2006 9:34 am Post subject: (No subject) |
|
|
for #3, basically you want four integers a,b,c,d > 0 such that a*b*c*d = 981 = a+b+c+d ?
if so, i dont think there is a solution.. can anyone confirm this? |
|
|
|
|
 |
md

|
Posted: Tue May 23, 2006 12:09 pm Post subject: (No subject) |
|
|
codemage wrote: If you ask me, this seems like another elaborate scheme for Cornflake to get us to do his homework for him. Perhaps you should explain the nature of this "contest" and if it's for an "experimental class" and who your "teacher's" name is.
For the last time, Cornflake. Do your own work. There are some excellent tutorial sections here for you to learn how to solve these problems the honest way.

Ha! I'm currently working for the summer so no classes for me I just wanted to encourage other people to actually do something duringthe summer (I forgot you silly people still had school) so I figured "Contest!" Blame timmytheturtle for the prizes... they were only going to be $1 at first.
Zylum; there is indeed a solution to #3. There is only one solution though. I have solutions to all the questions; if they weren't possible I wouldn't have posted them
[edit] bonus finally posted; as a hint there are ~180 sets. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
zylum

|
Posted: Tue May 23, 2006 1:32 pm Post subject: (No subject) |
|
|
nvm, i was using integers rather than decimals
176 sets? |
|
|
|
|
 |
zylum

|
Posted: Tue May 23, 2006 3:55 pm Post subject: (No subject) |
|
|
any clues for 12? |
|
|
|
|
 |
md

|
Posted: Tue May 23, 2006 8:36 pm Post subject: (No subject) |
|
|
zylum wrote: nvm, i was using integers rather than decimals
176 sets?
It's doable using integers... infact that's how my code does it. You just need to remember that if you multiply 9.81 by 100 to get into integers you also need to do the other side right too (hint hint).
#12. Horner's Technique. Character arrays. |
|
|
|
|
 |
md

|
Posted: Thu May 25, 2006 12:01 pm Post subject: (No subject) |
|
|
So far no solutions... is anyone actually working on them? |
|
|
|
|
 |
zylum

|
Posted: Thu May 25, 2006 12:40 pm Post subject: (No subject) |
|
|
i still dont get #12... horner's method is for solving polynomials, what does that have to do with perfect squares?
i have done all the others, which were really easy... ill submit once i finish #12. |
|
|
|
|
 |
md

|
Posted: Thu May 25, 2006 2:53 pm Post subject: (No subject) |
|
|
really easy == poor, but that someone actually tried them is good. Hopefully someone else tries them too
I'm not exactly sure how the solution to #12 works... all I can go by is the explanation and what code I do understand. |
|
|
|
|
 |
MysticVegeta

|
Posted: Thu May 25, 2006 8:21 pm Post subject: (No subject) |
|
|
I have done 17.. easy so far but 12 sorta f**ked me up. I found a pascal solution, too bad I dont read pascal... would someone test it or tell everyone whats going on in this?
code: | unit U_problem12 ;
{ The sequence of triangle numbers is generated by adding the natural numbers.
So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first
ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first 7 triangle numbers:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
We can see that the 7th triangle number, 28, is the first triangle number to
have over five factors.
Which is the first triangle number to have over five-hundred factors?
}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function nbrfactors(n:integer):integer;
var
i:integer;
begin
result:=0;
for i:= 1 to trunc(0.0+sqrt(n))-1 do
if n mod i = 0 then result:=result+2;
if n mod trunc(0.0+sqrt(n)) =0 then inc(result); {perfect square}
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i,t,n:integer;
begin
t:=1;
for i:= 2 to 100000 do
begin
t:=t+i;
n:= nbrfactors(t);
if n>500 then
begin
showmessage(inttostr(t)+ ' has '+inttostr(n)+ ' factors');
break;
end;
end;
end;
end.
|
|
|
|
|
|
 |
|
|