This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| prev = [] | |
| start = 5 | |
| num = start | |
| lastPrime = (0,0) | |
| ctr = 2 # 5 is the 3rd prime | |
| while ctr < 50000: | |
| isPrime = not any(num % n == 0 for n in prev) | |
| if isPrime: | |
| ctr += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import floor | |
| def pp(n): | |
| return (6*(floor(n/2)+1)) + (-1 if n % 2 == 0 else 1) | |
| for i in xrange(0, 50): | |
| print "%d\t\t%d" % (i, pp(i)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def nBang(n): | |
| mul = 1 | |
| for i in xrange(1,n+1): | |
| mul *= i | |
| return mul | |
| def R(n): | |
| bang = str(nBang(n)) | |
| sum = 0 | |
| for i in xrange(0, len(bang)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If not running interactively, don't do anything | |
| [ -z "$PS1" ] && return | |
| export EDITOR='mate' | |
| export GIT_EDITOR='mate -wl1' | |
| ## Aliases | |
| # alias ls="ls --color=always" | |
| alias ls="ls -G" | |
| alias ll="ls -l -h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Usage: | |
| -(void)doStuff:(id)sender { | |
| NSString *text = [RSAlertViewTextInput textWithTitle:@"Enter your zipcode" cancelBtn:@"Cancel" submitBtn:@"Submit"]; | |
| NSLog(@"nom: %@", text); | |
| } | |
| Easy to use, one line of code. Or you can initialize it and figure it out that way. |
NewerOlder