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
// Några grundläggande inställningar | |
var canvas = document.querySelector('canvas'); | |
canvas.width = window.innerWidth; | |
canvas.height = 0.8*window.innerHeight; | |
// Genom variabeln c kommer man åt det mesta som | |
// med canvas att göra | |
var c = canvas.getContext('2d'); | |
// Blå kvadrat |
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
# Program som beräknar summan av de jämna Fibonacci-talen, | |
# där den största termen är som mest 4 000 000. | |
# Se https://projecteuler.net/problem=2 | |
a = 1 | |
b = 2 | |
# Listan fib_numbers kommer att innehålla de Fibonacci-tal | |
# som ska summeras | |
fib_numbers = [] |
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
# Factorization of a number to primes | |
from math import sqrt | |
the_number = 2*3*3*5**3*35*51 | |
primes = [] | |
def factorize(number): | |
factor_1 = 1 | |
factor_2 = 2 | |
while factor_2 <= int(sqrt(number)): | |
if number % factor_2 == 0: |
OlderNewer