Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.

Learn More!


Download to Enter
| Contest Rules

Tutorials | Forums

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 7th, 2012, 02:40 AM
breadbox's Avatar
breadbox breadbox is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Location: Sydney, Australia
Posts: 61 breadbox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 6 m 11 sec
Reputation Power: 1
Project Euler Problem 1

Yes, yes...I know, problem 1 easy easy. Etc.

Seriously though, I have no idea what I have gotten wrong.
It says sum of multiples of 3 OR 5 below 1000. I chose 3, I wrote a program that took the input of the user, 3, and I used a while loop (while y<=999) and appended the values within the list. This is what I get:


Code:
[3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240, 243, 246, 249, 252, 255, 258, 261, 264, 267, 270, 273, 276, 279, 282, 285, 288, 291, 294, 297, 300, 303, 306, 309, 312, 315, 318, 321, 324, 327, 330, 333, 336, 339, 342, 345, 348, 351, 354, 357, 360, 363, 366, 369, 372, 375, 378, 381, 384, 387, 390, 393, 396, 399, 402, 405, 408, 411, 414, 417, 420, 423, 426, 429, 432, 435, 438, 441, 444, 447, 450, 453, 456, 459, 462, 465, 468, 471, 474, 477, 480, 483, 486, 489, 492, 495, 498, 501, 504, 507, 510, 513, 516, 519, 522, 525, 528, 531, 534, 537, 540, 543, 546, 549, 552, 555, 558, 561, 564, 567, 570, 573, 576, 579, 582, 585, 588, 591, 594, 597, 600, 603, 606, 609, 612, 615, 618, 621, 624, 627, 630, 633, 636, 639, 642, 645, 648, 651, 654, 657, 660, 663, 666, 669, 672, 675, 678, 681, 684, 687, 690, 693, 696, 699, 702, 705, 708, 711, 714, 717, 720, 723, 726, 729, 732, 735, 738, 741, 744, 747, 750, 753, 756, 759, 762, 765, 768, 771, 774, 777, 780, 783, 786, 789, 792, 795, 798, 801, 804, 807, 810, 813, 816, 819, 822, 825, 828, 831, 834, 837, 840, 843, 846, 849, 852, 855, 858, 861, 864, 867, 870, 873, 876, 879, 882, 885, 888, 891, 894, 897, 900, 903, 906, 909, 912, 915, 918, 921, 924, 927, 930, 933, 936, 939, 942, 945, 948, 951, 954, 957, 960, 963, 966, 969, 972, 975, 978, 981, 984, 987, 990, 993, 996, 999]


I then use print sum(x) to add them all up and I get 166833

The answer is incorrect. Same thing for 5's. Answer is also incorrect if I had the sums of the 3's and the 5's...

Starting to think I'm confused about what the question is asking. If you need me to post the code then I shall, also I'm not looking for the answer to the problem just a hint that can point me in the right direction if need be. Thank you.

Reply With Quote
  #2  
Old February 7th, 2012, 11:21 AM
requinix's Avatar
requinix requinix is offline
Woof
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 10,754 requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)requinix User rank is General 105th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 10 h 38 m 33 sec
Reputation Power: 7951
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix
Yes, you're confused about the question.

You are to look at all numbers between 1 and 1000 and sum up the ones that are divisible by 3 as well as the ones divisible by 5. Thus the sequence begins 3, 5, 6, 9, 10...

Note how you can't just add up the totals from the divisible-by-three and divisible-by-five sequences because they'll have some numbers in common (15, 30, 45...) and you'd be incorrectly counting them twice.
Comments on this post
breadbox agrees!

Reply With Quote
  #3  
Old February 7th, 2012, 12:36 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Click here for more information.
 
Join Date: Aug 2011
Posts: 1,075 b49P23TIvg User rank is Second Lieutenant (5000 - 10000 Reputation Level)b49P23TIvg User rank is Second Lieutenant (5000 - 10000 Reputation Level)b49P23TIvg User rank is Second Lieutenant (5000 - 10000 Reputation Level)b49P23TIvg User rank is Second Lieutenant (5000 - 10000 Reputation Level)b49P23TIvg User rank is Second Lieutenant (5000 - 10000 Reputation Level)b49P23TIvg User rank is Second Lieutenant (5000 - 10000 Reputation Level)b49P23TIvg User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 4 h 41 m 27 sec
Reputation Power: 98
Lots of laughter.

The problems at Project Euler ALL have an unique answer. Use this knowledge in subsequent understanding.

Reply With Quote
  #4  
Old February 7th, 2012, 02:42 PM
breadbox's Avatar
breadbox breadbox is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Location: Sydney, Australia
Posts: 61 breadbox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 6 m 11 sec
Reputation Power: 1
Quote:
Originally Posted by requinix
Yes, you're confused about the question.

You are to look at all numbers between 1 and 1000 and sum up the ones that are divisible by 3 as well as the ones divisible by 5. Thus the sequence begins 3, 5, 6, 9, 10...

Note how you can't just add up the totals from the divisible-by-three and divisible-by-five sequences because they'll have some numbers in common (15, 30, 45...) and you'd be incorrectly counting them twice.


Ohhhhhh lol I see now. Thanks for that.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Project Euler Problem 1


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap