This file contains 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
#!/usr/bin/env python | |
import Image | |
import os, sys | |
def resizeImage(infile, dir, output_dir="", size=(1024,768)): | |
outfile = os.path.splitext(infile)[0]+"_resized" | |
extension = os.path.splitext(infile)[1] | |
if extension.lower()!= ".jpg": |
This file contains 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 urllib2, urllib, sys | |
from BeautifulSoup import BeautifulSoup | |
import re | |
class VisaVale(): | |
def get_visavale_informations(self,visa): | |
url = 'http://www.cbss.com.br/inst/convivencia/SaldoExtrato.jsp' | |
data = urllib.urlencode([('numeroCartao',visa),('primeiroAcesso','S')]) | |
request = urllib2.Request(url) |
This file contains 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 sys | |
def prime(number): | |
n = abs(number) | |
if n < 1: | |
return False | |
if n==2: | |
return True |
This file contains 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
;******************************************************************************************************************* | |
;Demonstrates the Goldbach's conjecture - Every even integer greater than 2 can be expressed as the sum of two primes | |
; | |
;Author: Igor Hercowitz | |
; | |
;usage: clisp goldbach.lisp <number> | |
;output: the sum of the primes list | |
; | |
;Ex: | |
;> clisp goldbach.lisp 100 |
This file contains 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
/* Demonstrates the Goldbach's conjecture - Every even integer greater than 2 can be expressed as the sum of two primes | |
* | |
* author: Igor Hercowitz | |
* | |
* usage: java Goldbach <number> | |
* output: the sum of the primes list | |
* | |
* ex: | |
* > java Goldbach 100 | |
* 100 can be writen as: [97+3, 89+11, 83+17, 71+29, 59+41, 53+47] |
This file contains 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
%Demonstrates the Goldbach's conjecture - Every even integer greater than 2 can be expressed as the sum of two primes | |
% | |
% author: Bruno Jessen | |
% | |
-module(goldbach). | |
-export([primes/1, goldbach/1]). | |
This file contains 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
package com.testes; | |
/* Demonstrates the Goldbach's conjecture - Every even integer greater than 2 can be expressed as the sum of two primes | |
* | |
* author: Luiz Vessosa | |
*/ | |
import java.util.ArrayList; |
This file contains 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
/* Goldbach's conjecture in JavaScript | |
* | |
* author: Igor Hercowitz | |
*/ | |
function isPrime(n) { | |
if (n % 2 === 0) return false; | |
var sqrtn = Math.sqrt(n)+1; |
This file contains 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
/* Goldbach's conjecture in JavaScript - using Recursion | |
* | |
* author: Igor Hercowitz | |
*/ | |
function isPrime(n) { | |
if (n % 2 === 0) return false; | |
var sqrtn = Math.sqrt(n)+1; |
This file contains 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
/* | |
* The 3n + 1 Problem | |
*Consider the following algorithm to generate a sequence of numbers. Start with an | |
*integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this | |
*process with the new value of n, terminating when n = 1. For example, the following | |
*sequence of numbers will be generated for n = 22: | |
*22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 | |
*It is conjectured (but not yet proven) that this algorithm will terminate at n = 1 for | |
*every integer n. Still, the conjecture holds for all integers up to at least 1, 000, 000. | |
*For an input n, the cycle-length of n is the number of numbers generated up to and |
OlderNewer