106 - Fermat vs. Pythagoras

All about problems in Volume 1. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
yiuyuho
A great helper
Posts: 325
Joined: Thu Feb 21, 2002 2:00 am
Location: United States
Contact:

Post by yiuyuho »

hmm....news things everyday

thx.

so you just put the type definition before open block and variable names in ()?

THX
Almost Human
Learning poster
Posts: 93
Joined: Sun Jan 12, 2003 3:30 pm

106 - WA .. help

Post by Almost Human »

Any sample input and output ???

thanks in advance
Almost Human
Learning poster
Posts: 93
Joined: Sun Jan 12, 2003 3:30 pm

Post by Almost Human »

can anybody tell me what is the output for input like this :
1
10
100
1000
10000

thanks
Maarten
Experienced poster
Posts: 108
Joined: Sat Sep 27, 2003 5:24 pm

Post by Maarten »

Code: Select all

0 1
1 4
16 27
158 205
1593 1669
15919 14844
159139 133926
P.S. Please next time state the problem NAME along with the number. I think it makes you get more replies
Almost Human
Learning poster
Posts: 93
Joined: Sun Jan 12, 2003 3:30 pm

Post by Almost Human »

thank you for your advice.

I finally got an AC after realizing the difference between my last output ( for input 1000000 ) and yours.

many thanks
Sensor
New poster
Posts: 4
Joined: Tue Nov 18, 2003 10:01 pm

Problem Fermat vs. Pythagoras(106) - the second number

Post by Sensor »

Could someone help me.
In the problem [b]Fermat vs. Pythagoras(106) [/b]I can find all triples but how can I find the second number (count of number whitch are not in triples) ???
I can't even imagine anything!!!
iamdennis
New poster
Posts: 2
Joined: Tue Dec 16, 2003 5:24 pm

Problem 106 Fermat vs Phytagoras, help me

Post by iamdennis »

i want to know, what is the meaning of the first output number ?
i.e :
input = 10
output = 1 4
input = 100
output = 16 27

Thank's ![/pascal]
Almost Human
Learning poster
Posts: 93
Joined: Sun Jan 12, 2003 3:30 pm

Post by Almost Human »

input : 10
output : 1 4

pythagorean number from 1 to 10 :
3 , 4 , 5
6 , 8 , 10

1 is total of "triple pythagorean number that is relatively prime" form 1 to 10 ( 3 , 4 , 5 )
4 is total number that is not pythagorean number from 1 to 10 ( 1 , 2 , 7 and 9 )

I hope it help you
iamdennis
New poster
Posts: 2
Joined: Tue Dec 16, 2003 5:24 pm

Post by iamdennis »

ehm.. okay, thank's ! but, can you tell me, if the input is 100, can you tell me, the triple in there ? can be 16 ? i just can find 13.... thank's !
pavelph
Learning poster
Posts: 57
Joined: Wed Dec 10, 2003 7:32 pm
Location: Russia, Saint-Petersburg

Post by pavelph »

For n=100 answer will 16:
1)4 3 5
2)12 5 13
3)8 15 17
4)24 7 25
5)20 21 29
6)40 9 41
7)12 35 37
8)60 11 61
9)28 45 53
10)56 33 65
11)84 13 85
12)16 63 65
13)48 55 73
14)80 39 89
15)36 77 85
16)72 65 97
pavelph
Learning poster
Posts: 57
Joined: Wed Dec 10, 2003 7:32 pm
Location: Russia, Saint-Petersburg

Post by pavelph »

Hello!
Can anybody give outputs for 1<=N<=20? -I can`t understand what answer will for N=4: 0 4 or 0 2. Thanks.
pavelph
Learning poster
Posts: 57
Joined: Wed Dec 10, 2003 7:32 pm
Location: Russia, Saint-Petersburg

Post by pavelph »

Oh, hello. Sorry me for worring you
I`m already getting Accepted 8) [/b]
cthompson
New poster
Posts: 7
Joined: Sat Apr 17, 2004 4:23 am

106 - Wrong Examples?

Post by cthompson »

I am working on problem 106, the program seems to work correctly, except my output is different to the sample output.

input:
10
25
100

my output:
1 4
4 9
36 27

sample output:
1 4
4 9
16 27

I tailored the program to print out all the hits to see why I counted 36 and the sample counted only 16. After looking through all of them, I could see no valid reason, does anyone have any insight?
cthompson
New poster
Posts: 7
Joined: Sat Apr 17, 2004 4:23 am

(pow((double)ii, 2.0) --> Is there a better way?

Post by cthompson »

I am wanting to square some numbers (for problem 106).

ie

5^2

However the only way that I can see to do it is to use the pow function.

I tried ii^2, however errors where returned.

Does anyone know a better (faster) way?
cthompson
New poster
Posts: 7
Joined: Sat Apr 17, 2004 4:23 am

Post by cthompson »

I am so dumb. I can't believe I asked that.

Please ignore my question.

I couldn't see the forest for the trees.

*grin*....
Post Reply

Return to “Volume 1 (100-199)”