|
|
#1 |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
Super bored in class today, and I can't think of a way to use what I learned this past week to create any kind of exercise for myself, so I'm asking for some outside input.
I don't know much math past trig, and I'm not an expert with powershell. So take that into consideration. Anything goes, as long as the result of my script should end up with tangible output. (and don't use any project euler problems, I can't lrn2algorithm yet)
__________________
|
|
|
|
|
|
#2 |
|
no
Join Date: Jan 2004
Age: 34
Posts: 1,850
|
write a script to create anagrams from an input string (you can probably find source for this already but w/e)
|
|
|
|
|
|
#3 |
|
Kawaii Desu Ne?
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
|
Don't know what diff you are going after but here's one:
Input: A single string that contains words with any amount of comma's and spaces inbetween. Output: output each word (without the commas and spaces) on a separate line. Example: Input: "one, two, ,three,, , 4" Output: "one two three 4" |
|
|
|
|
|
#4 |
|
FFR Veteran
|
Write a script that finds a combination of positive integers (x,y,z) that satisfies the formula:
(x^3)+(y^3)=(z^3) |
|
|
|
|
|
#5 |
|
Kawaii Desu Ne?
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
|
Your sense of humor is very dark and sinister :c
|
|
|
|
|
|
#6 |
|
Can't AAA anything
Join Date: Sep 2007
Posts: 1,391
|
Oh wow Arkuski that's evil..
__________________
![]() ![]() |
|
|
|
|
|
#7 |
|
Kawaii Desu Ne?
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
|
Here's one that might peak your interest if you're bored.
Input: an integer n Output: The average distance between consecutive primes between (and including) 2 to n. Example: Input: 5 Output: 1.5 (Solution: There are three primes in that range: 2,3,5. The distance between 2 and 3 is 1 and the distance between 3 and 5 is 2. The average of all distances (1 and 2) is 1.5) Also, see if you can formulate some conjecture or educated guess on how the output changes as in the input increases. |
|
|
|
|
|
#8 |
|
FFR Player
Join Date: Sep 2012
Location: England
Posts: 466
|
write a program that takes as its input another program and outputs that same program with extra whitespace inserted to make it physically look like a toilet roll, but still be functional
(a friend-of-a-friend of mine did that in c++ as an assigned project)
__________________
![]() Theorem: If you have a large enough number of monkeys, and a large enough number of computer keyboards, one of them will sight-read AAA death piano on stealth. And the ffr community will forever worship it. Proof Example ask me anything here mashed FCs: 329 |
|
|
|
|
|
#9 | |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
if by valid anagrams you mean anagrams that make at least some sense, then that might be tough because I'd need a dictionary... unless I'm missing something
arkuski you're gay and I'm dumb as shit Quote:
that prime one sounds super interesting, but I am seriously shit at math so I would have no idea how to efficiently test a number to see if it's prime
__________________
|
|
|
|
|
|
|
#10 | |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
Quote:
what the christ
__________________
|
|
|
|
|
|
|
#11 |
|
Kawaii Desu Ne?
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
|
There are more efficient ways but the most brute force and intuitive way is to see if it is divisible by any numbers before it (which you can check by using a mod operator like % or whatever it may be in the programming language you use)
|
|
|
|
|
|
#12 |
|
FFR Veteran
Join Date: Dec 2007
Posts: 1,251
|
To make this slightly more efficient, testing though the number's square root is sufficient.
|
|
|
|
|
|
#13 |
|
Kawaii Desu Ne?
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
|
^This will help a lot and save you some time
|
|
|
|
|
|
#14 | |
|
no
Join Date: Jan 2004
Age: 34
Posts: 1,850
|
Quote:
also, for this specific prime number problem that ben mentioned, sieve of eratosthenes is your best friend since you are trying to find all of the prime numbers in a range. research and try to implement it. there is better algorithms, but they are more complicated to implement. Last edited by Fission; 08-12-2013 at 04:36 PM.. |
|
|
|
|
|
|
#15 |
|
I don't get no respect
Join Date: Jun 2006
Age: 34
Posts: 1,332
|
Write a program that takes as it's input any ddreamstudio file.
Output a list of BPM changes such that if there is any BPM change within 5 BPM of an adjacent one, the first one should be redone as the average of those BPMs while the others are removed. Don't redo BPMs if they are not all within 5 BPM of each other. Do not use your calculated averages in another calculation. eg. in (parse file to bpm changes) 0=141, 3=143, 19=147, 28=149 out 0=142, 19=148 Sample input if you need some Last edited by trumaestro; 08-12-2013 at 04:48 PM.. |
|
|
|
|
|
#16 |
|
Senior Member
|
How about wordcounters, I had fun with those because of all the little extra things you can work towards (ignoring numbers, acronyms, common words, etc) and it's not mathy at all
bonus points if you use a sorting algorithm of your choice to sort in descending order of occurrence triple bonus points if it outputs a wordcloud rather than a list
__________________
|
|
|
|
|
|
#17 |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
okay yeah, that prime number one looks a LOT easier now, gonna have to write some pseudo-code tonight and then I'll script it tomorrow at lunch
for the DDReam one, that'll take a bit, I think. I don't know much about .ds files too, are they relatively the same as .sm files? the word counter would be trivial but I don't think powershell has the power (HEH) to generate wordclouds. maybe if I stopped being lazy and picked up javascript or java again.
__________________
Last edited by Choofers; 08-12-2013 at 05:13 PM.. |
|
|
|
|
|
#18 |
|
Mrow~
|
On prime testing: create a list with primes, and for any next number you only need to test if it is divisable by any element in that list that is smaller than or equal to the square root of the number you're testing. If not, add it to the list of primes. Continue until you feel satisfied.
For the number 100, you'd only have to check if it is divisible by any element in {2,3,5,7} since only those primes are leq 10. Of course you can immediately stop after checking 2, but the point is clear. (The reason that going through the square root is enough is because if your number n equals p*k for a p>sqrt(n) then k<sqrt(n) and you'd have found k already.) Edit: Using this method also makes it really easy to make another list that calculates the prime gaps.
__________________
948 AAAs | 1461 FCs | 549 TPs | 7 FMO AAAs Best AAAs: Exciting Hyper Highspeed Star (69), Nous (69), Pure Ruby (68), Heavenly Spores (68), Ambient Angels (66), Within Life (66), Defection (66) Southern Cross (65) Last edited by PaperclipGames; 08-12-2013 at 05:14 PM.. |
|
|
|
|
|
#19 |
|
Wubalubadubdub
Join Date: May 2005
Age: 38
Posts: 1,697
|
I don't know anything about powershell or how hard you want this to be so here's a fairly common (I think) somewhat easy interview question:
Write a program that takes in a string, reverses it, and prints the result. Try to do this as efficiently as possible, that's the hard part ![]()
__________________
boop |
|
|
|
|
|
#20 | ||
|
Fractals!
|
Quote:
As you can see, the runtime would go up quite quickly even to 100 because then you're running stuff for 49 that's like "2, yes. 3, yes. 5, yes. 7, no. 49 is not prime, do not add it to the list of test divisors, on to 50." As you can see, the sieve of Erastothenes is probably better for numbers in a range 1 to n inclusive. Remove 1, spare 2, remove all multiples of 2. Spare 3, remove all multiples of 3. Next number is 5, so remove all multiples of 5, and so on.
__________________
Quote:
Last edited by igotrhythm; 08-12-2013 at 06:58 PM.. |
||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|