Go Back   FlashFlashRevolution > Life & The Arts > Bits and Bytes

Bits and Bytes Dedicated to the realm of programming, game development, and general computer issues!

Reply
 
Thread Tools Display Modes
Old 12-21-2012, 08:13 PM   #241
kaiten123
FFR Player
 
Join Date: May 2008
Age: 21
Posts: 1,025
Default Re: The Project Euler thread

just did 96 which was cool since i never really used recursion in a way that was non-trivial before
no idea how you guys do some of the higher numbered ones, highest one i did was 243, which for some reason is many times easier than everything around it, didnt even write any code.

edit: got to lvl 3 :)

Last edited by kaiten123; 12-23-2012 at 01:49 AM.. Reason: lvl up
kaiten123 is offline   Reply With Quote
Old 12-28-2012, 10:24 PM   #242
kaiten123
FFR Player
 
Join Date: May 2008
Age: 21
Posts: 1,025
Default Re: The Project Euler thread

brute forced 407 lol
never saw that box at the bottom right before, is that new? or does it pop up when you solve something recent?
kaiten123 is offline   Reply With Quote
Old 12-29-2012, 03:18 PM   #243
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

tis new
Reincarnate is offline   Reply With Quote
Old 12-30-2012, 12:11 AM   #244
leonid
(ง'̀-'́)ง
FFR Simfile Author
FFR Music Producer
 
leonid's Avatar
 
FFR Veteran
Join Date: Oct 2008
Location: MOUNTAIN VIEW
Age: 24
Posts: 6,869
Default Re: The Project Euler thread

i should get back to solve rest of the problems
__________________

leonid is offline   Reply With Quote
Old 01-1-2013, 08:35 PM   #245
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

Managed to squeak onto the 408 list; hard one
Reincarnate is offline   Reply With Quote
Old 01-4-2013, 02:36 PM   #246
Arkuski
FFR Veteran
 
Arkuski's Avatar
 
FFR Veteran
Join Date: Jul 2006
Location: Rhode Island
Age: 20
Posts: 432
Send a message via AIM to Arkuski Send a message via Skype™ to Arkuski
Default Re: The Project Euler thread

This is pretty awesome I'm giving some of these a go
__________________


Kill all of the Pokemon!
Arkuski is offline   Reply With Quote
Old 01-17-2013, 10:07 PM   #247
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

I think 411 will be on the easier side this week... I hope.
Reincarnate is offline   Reply With Quote
Old 01-22-2013, 07:52 PM   #248
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

411 wasn't too bad -- pretty much an exercise in programming
Reincarnate is offline   Reply With Quote
Old 02-12-2013, 07:43 PM   #249
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

414: Got this one somewhat quickly but it took me forever to bring it down to under a minute, lol. In the end got it to 10 seconds.
Reincarnate is offline   Reply With Quote
Old 02-17-2013, 11:40 AM   #250
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

415... only 3 solvers after 7 and a half hours.

Yeah I can pretty much kiss my 100% goodbye

It's been fun, PE :(
Reincarnate is offline   Reply With Quote
Old 02-21-2013, 04:25 PM   #251
MracY
FFR Veteran
 
MracY's Avatar
 
FFR Veteran
Join Date: Oct 2007
Posts: 84
Default Re: The Project Euler thread

Quote:
Originally Posted by Reincarnate View Post
2 mod 3 is 2

(x mod y is the remainder of x / y)

PS use Python instead, it's cooler



sumTotal = 0
num = 1
while num < 1000:
if (num % 3 == 0) or (num % 5 == 0):
sumTotal = sumTotal + num
num = num + 1
print sumTotal


Damn thing doesn't save formatting but w/e
Just as a note to people who want to join Project Euler: this solution is not necessarily representative of what you will be doing.

Here are some of my crude notes for problem 1, that used logic in stead of programming:





vertical axis is m
horizontal axis is n


Sum of the series of 5 is 0.5nm+0.5m
Sum of the series of 3 is 0.5pq+0.5q

1000/5 = 200.
The last value here is 1000, so n = 199
m = 1000-5 = 995

1000/3 = 333 with 1 remainder, so p = 333
q = 1000-1 = 999

Sum5 = 0.5*199*995+0.5*995
= 99500

Sum3 = 0.5*333*999+0.5*999
= 167166

99500+166833=266333



There is overlap between the sums of multiples of 15.
1000/15 is 66 with 10 remainder, so x = 66
y = 1000-10 = 990

Sum of this series is 0.5xy+0.5y
= 0.5*66*990+0.5*990 = 33165

So the answer is: 99500+166833-33165 = 233168
MracY is offline   Reply With Quote
Old 02-22-2013, 10:21 PM   #252
leonid
(ง'̀-'́)ง
FFR Simfile Author
FFR Music Producer
 
leonid's Avatar
 
FFR Veteran
Join Date: Oct 2008
Location: MOUNTAIN VIEW
Age: 24
Posts: 6,869
Default Re: The Project Euler thread

@Reincarnate use code tag

Code:
while 1:
  print "INDENT"
  if "INDENT":
    print "MORE INDENT"
print "NEVER REACHES HERE"
__________________

leonid is offline   Reply With Quote
Old 02-22-2013, 10:32 PM   #253
reuben_tate
Cocoa Nuts
Local Moderator
 
reuben_tate's Avatar
 
FFR Veteran
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 19
Posts: 2,999
Send a message via MSN to reuben_tate Send a message via Skype™ to reuben_tate
Default Re: The Project Euler thread

Maybe ill try to play around and do some more problems this weekend :) (I haven't touched PE in awhile) . gotta start on my take-home test and other school stuff first though xP
__________________





FMO AAA's
: (4)
Makiba (Oni get! ), Colorful Course, Pure Ruby, and Melonman's OP (although the game seems to think otherwise about the last one)


Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
My "warm" welcome to D4:
Quote:
Originally Posted by Xx{Midnight}xX View Post
Hi, my name is Midnight, / I'd like to be the first to welcome you to D4. / I'm also going to be the first to make you lose. / Enjoy your (rather quick) stay. / I'm kidding <3 I look forward to this
Quote:
Quote:
Originally Posted by reuben_tate
I'd shoot myself >_>...Nah, I wouldn't really do that. I'd be pissed though and would probably stop playing for the rest of the day.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
Quote:
Originally Posted by hi19hi19 View Post
mfw when BOTH of you failed to take a screenshot right; this is not rocket surgery people
Middie showing his God complex:


Middie 10 years from now:

Current Rivals: none...rip


reuben_tate is offline   Reply With Quote
Old 02-22-2013, 11:45 PM   #254
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

415 is a worthy challenge -- very fun but hard. Not many solvers on the first week. Whoever sk7 is, he's insane.

also damn didn't know code tag existed on ffr
Reincarnate is offline   Reply With Quote
Old 02-25-2013, 10:08 PM   #255
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

Got my program for 416 working but mothereffing thing is taking eons
Reincarnate is offline   Reply With Quote
Old 02-26-2013, 11:55 AM   #256
reuben_tate
Cocoa Nuts
Local Moderator
 
reuben_tate's Avatar
 
FFR Veteran
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 19
Posts: 2,999
Send a message via MSN to reuben_tate Send a message via Skype™ to reuben_tate
Default Re: The Project Euler thread

Started doing this in my free time again :3 Just got problem 34 this morning. Problem and code below; any tips that can make me a better programmer or mathematician is greatly appreciated :P

problem:

145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.

Find the sum of all numbers which are equal to the sum of the factorial of their digits.

Note: as 1! = 1 and 2! = 2 are not sums they are not included.


solution: (in Java)

Code:
//this will be our final answer
		int probSum = 0;
		
		//at some point, the sum of the factorials of the digits won't be large enough to add up to the number
		//so choose our digits to be 9 and find when we have too many digits
		//our upper bound for curious numbers becomes k
		int i = 1;
		int nFact = factorial(9);
		int k = 9;
		while(i*nFact > k)
		{
				k += 9*Math.pow(10, i);
				i++;
		}
		
		for(int j=10; j <=k ; j++)
		{
			String[] digits = (j+"").split("");
			
			int sum = 0;
			for(int l = 1; l < digits.length; l++)
			{
				sum += factorial(Integer.parseInt(digits[l]));
			}
			
			if(j==sum)
			{
				probSum += j;
			}
		}
		
		System.out.println(probSum);



EDIT: cool, got another :3


Problem:

Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.

For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 53 = 49714.

What is the total of all the name scores in the file?


Solution:

Code:
int totalScore = 0;
		
		File file = new File("names.txt");
		Scanner scan = null;
		try 
		{
			scan = new Scanner(file);
		} 
		catch (FileNotFoundException e) {}
		String nameString = scan.next();
		String[] names = nameString.split("\",\"");
		ArrayList<String> names2 = new ArrayList<String>();
		for(int i = 0; i < names.length; i++)
		{
			names2.add(names[i]);
		}
		
		Collections.sort(names2);
		for(int i = 0; i < names2.size(); i++)
		{
			char[] chars = names2.get(i).toCharArray();
			int charSum = 0;
			for(int j = 0; j < chars.length; j++)
			{
				charSum += chars[j] - 'A' + 1;
			}
			totalScore += charSum*(i+1);
		}
		System.out.println(totalScore);
__________________





FMO AAA's
: (4)
Makiba (Oni get! ), Colorful Course, Pure Ruby, and Melonman's OP (although the game seems to think otherwise about the last one)


Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
My "warm" welcome to D4:
Quote:
Originally Posted by Xx{Midnight}xX View Post
Hi, my name is Midnight, / I'd like to be the first to welcome you to D4. / I'm also going to be the first to make you lose. / Enjoy your (rather quick) stay. / I'm kidding <3 I look forward to this
Quote:
Quote:
Originally Posted by reuben_tate
I'd shoot myself >_>...Nah, I wouldn't really do that. I'd be pissed though and would probably stop playing for the rest of the day.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
Quote:
Originally Posted by hi19hi19 View Post
mfw when BOTH of you failed to take a screenshot right; this is not rocket surgery people
Middie showing his God complex:


Middie 10 years from now:

Current Rivals: none...rip



Last edited by reuben_tate; 02-26-2013 at 12:36 PM..
reuben_tate is offline   Reply With Quote
Old 03-1-2013, 09:44 AM   #257
Arkuski
FFR Veteran
 
Arkuski's Avatar
 
FFR Veteran
Join Date: Jul 2006
Location: Rhode Island
Age: 20
Posts: 432
Send a message via AIM to Arkuski Send a message via Skype™ to Arkuski
Default Re: The Project Euler thread

Learned some jython, and these are all much easier
__________________


Kill all of the Pokemon!
Arkuski is offline   Reply With Quote
Old 03-3-2013, 08:05 PM   #258
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

Anyone else try their hand at 415? It's a beast :X
Reincarnate is offline   Reply With Quote
Old 03-21-2013, 07:01 PM   #259
Reincarnate
x'); DROP TABLE FFR;--
 
Reincarnate's Avatar
 
FFR Veteran
Join Date: Nov 2010
Location: NYC - Manhattan
Age: 26
Posts: 4,646
Default Re: The Project Euler thread

pumped for saturday ;O
Reincarnate is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 07:34 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution