Re: The Project Euler thread
A little extra time preplanning goes a long way
For 35 you just need a simple sieve and a short rotator method 
Re: The Project Euler thread
one thing you could do is keep anything you do more than once in its own method/function/etc. so you only write code once per program.
an extention of that is to have a library of common functions so you dont need to rewrite them. like one for generating primes and so on so you can just reuse it for many problems. still,100 lines seems pretty excessive for that problem. what part is making it so long? generating the primes should only take a few lines, rotating should only be a few lines, etc. and lastly, theres usually multiple ways to solve a problem and the one that is fastest on paper might not be the fastest to code so you should keep coding time in mind while thinking of how to solve stuff. 
Re: The Project Euler thread
Here's a solution I just wrote for 35 in Python:
This can be optimized further but my point is that the underlying logic is pretty straightforward and you can get a fast program without many lines of code (the above code runs in about half a second on my machine). 
Re: The Project Euler thread
I'm using javascript atm. I'm not sure if that has any relevance but uh yeah. I do reuse a lot of my functions and stuff, and trust me when I say that I'm very familiar with basic concepts such as "fastest paper method might not be fastest to code"
it's not math or problem solving that's difficult for me. I can do more of these problems by hand than almost anyone else. I'm simply not super fluent in programming. a lot of complex algorithms are flying through my head all the time, but figuring out how to convert that into code is sometimes difficult here's the main function I used to check for a circular prime (I use other functions but didn't post them) 
Re: The Project Euler thread
I used PARI/GP only for dealing with really large primes (used C before I knew about PARI/GP)
Even though Ruby is a very slow language, it served me well enough for almost all the remaining problems I solved, and very rarely did my codes go above 20 lines Some people on PE try to solve every problem using ASM but that's just stretching it too far Here's my friend code if anyone wants to add me 7432696421787_8325ecaf1469afb6ad991ac1dacb210c 
Re: The Project Euler thread
My code took 9 minutes :( EDIT: Tried the same algo on PARI/GP and it took 3 seconds 
Re: The Project Euler thread
Thinking of making an extra dummy account and starting fresh, using none of my old libraries.
leonid: problem is much faster in something like C++ Edit: nvm ninja'd, PARI/GP is very fast too for that one apparently XD 
Re: The Project Euler thread
PARI/GP is god
never underestimate PARI/GP 
Re: The Project Euler thread
My only complaint is I can't use GP noninteractively.
So I have to write code somewhere else and copy/paste into the interactive shell. Also since every command is supposed to be 1 line, I need to put a \ at the end of each line, so my code becomes ugly Actually I think I can get it to work somehow, brb.. 
Re: The Project Euler thread
cool 
Re: The Project Euler thread
Quote:
I'm trying to learn a bit of Python at the moment, so that's what I've been coding in. However, at least from my viewpoint, Python is horrifically slow (one source whose credibility I did not check which I found interesting regarding programming languages vs speed: here). On the bright side, in the case that Python is slower than other programming languages I've used, this forces me to come up with more efficient algorithms. Only did the first 15 for now: New friend key: Code:
95430157644057_56e54c547c0f732b3b941aec7177ce58 
Re: The Project Euler thread
Really messy 
Re: The Project Euler thread
Reuben: even in Python, most problems can be done in under a second

Re: The Project Euler thread
I did this RSA problem by manual empirical pattern recognizing with lots of experiments, small examples, and blind guessworks
And then I saw the real way of solving it in the thread. I feel like I cheated through this, but I guess what I learned in this thread will help me on other problems @Reincarnate Check my code in the thread if you want to see what I mean http://projecteuler.net/thread=182&page=4#171693 
Re: The Project Euler thread
Quote:

Re: The Project Euler thread
Quote:

Re: The Project Euler thread
PARI/GP
seriously ALL HAIL PARI/GP 
Re: The Project Euler thread
Had me stumped for a few minutes 
Re: The Project Euler thread
I used Ruby this time because GP has no hash tables ?_? 
Re: The Project Euler thread
fun 
All times are GMT 5. The time now is 08:36 AM. 
Powered by vBulletin® Version 3.8.1
Copyright ©2000  2022, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution