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 __future__ import division | |
| def phi(i): | |
| l=[] | |
| n=1 | |
| multiples = set() | |
| for p in range(2, i+1): | |
| if p not in multiples: | |
| multiples.update(range(p*p, i+1, p)) | |
| if i%p==0: | |
| j=(p-1)/p |
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 xmdc(a,b): | |
| if b==0: | |
| return [1,0,a] | |
| else: | |
| x,y,d=xmdc(b, a%b) | |
| return [y,x-(a//b)*y,d] |
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 mdc(a,b): | |
| while(b!=0): | |
| c=a%b | |
| a=b | |
| b=c | |
| print a | |
| mdc(2024,748) |
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
| d = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] | |
| input = raw_input('>> ') | |
| texto = input.replace(' ','').upper() | |
| if len(texto)>28: | |
| sys.exit() | |
| if len(texto)<2: | |
| sys.exit() | |
| else: | |
| t = len(texto) |
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
| import time | |
| import math | |
| start = time.time() | |
| def primo(n): | |
| if n%2==0: return False | |
| return not any(n%i==0 for i in range(3, int(math.sqrt(n))+1,2)) | |
| sum = 0 |
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
| import urllib | |
| import requests | |
| from bs4 import BeautifulSoup | |
| import re | |
| import urllib2 | |
| import MySQLdb as mdb | |
| import simplejson as json | |
| import getpass | |
| import time |
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 bs4 import BeautifulSoup | |
| import requests | |
| import re | |
| import socket | |
| url=raw_input(">> ") | |
| site = 'http://www.iana.org/whois?q='+url | |
| r = requests.get(site) | |
| soup = BeautifulSoup(r.text) |
NewerOlder