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
-- LFSR, en formato compatible con | |
-- http://homepage.mac.com/afj/taplist.html | |
-- uso (en ghci): | |
-- > let t = ciclo 7 $ drop 7 $ leer $ generar "1111111" [7,6,4,2] | |
-- "1111111" es cadena inicial con 7 registros | |
-- [7, 6, 4, 2] es cuarteta en http://homepage.mac.com/afj/7bits.txt | |
-- 'ciclo 7' se detiene cuando se repite la secuencia de los 7 primeros símbolos | |
-- > t | |
-- "00111110110111000000101000011011 |
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
-- head = LSB | |
decimal_a_bool :: Integer -> [Bool] | |
decimal_a_bool 1 = [True] | |
decimal_a_bool n = odd n : decimal_a_bool (div n 2) | |
bool_a_decimal :: [Bool] -> Integer | |
-- La cadena vacía no tiene representación | |
bool_a_decimal [] = error "Sin entrada" |
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
porTresMasUno :: [Bool] -> [Bool] | |
porTresMasUno xs = False : ys ++ residuo where | |
cs = True : zipWith3 gc cs (tail xs) xs | |
gc b = if b then (||) else (&&) | |
ys = zipWith3 gy cs (tail xs ++ [False]) xs | |
gy p q r = (p /= q) /= r | |
residuo = if last cs then [True] else [] | |
serie :: String -> [[Bool]] | |
serie s = takeWhile (not.alto) $ iterate paso $ leer s where |
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
-- CollatzBool.hs | |
module CollatzBool where | |
porTresMasUno :: [Bool] -> [Bool] | |
porTresMasUno xs = False : ys ++ residuo where | |
cs = True : zipWith3 gc cs (tail xs) xs | |
gc b = if b then (||) else (&&) | |
ys = zipWith3 gy cs (tail xs ++ [False]) xs | |
gy p q r = (p /= q) /= r |
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
PARI/GP | |
La serie formal generada por (3*x^2 + 5)/((1-x^2)*(1-x)^2) hasta x^99, el O(x^n) | |
representa el error y al sumarlo GP entiende que es serie en lugar de solamente | |
función racional | |
? p = (3*x^2 + 5)/((1-x^2)*(1-x)^2) + O(x^100) | |
Extrae el coeficiente de x^45 |
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
Recurrencia a(n+2) + 2*a(n+1) + 2*a(n) = 0, n >= 0, a(0) = 1, a(1) = 3 | |
[GP] (recuperando las raíces) | |
? polroots(x^2+2*x+2) | |
%1 = [-1.000000000000000000000000000 - 1.000000000000000000000000000*I, -1.000000000000000000000000000 + 1.000000000000000000000000000*I]~ | |
[Haskell] | |
(construyendo la recurrencia directamente) |
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
/* archivo, test.c */ | |
#include <stdio.h> | |
void main () { | |
char c; | |
c = c & 0; | |
printf("The value of c is %d", (int)c); | |
int j = 255; | |
c = (c | j); |
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 Math.Combinat.Numbers | |
import Data.Ratio | |
-- OEIS A141765: el número de cadenas de longitud n en un alfabeto de | |
-- longitud r que no repiten más de dos veces el mismo símbolo | |
t :: Integer -> Integer -> Integer | |
t r n = sum $ map g [a..r] where | |
a = quot (n+1) 2 | |
g k = if n < k then 0 else |
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
/* reservando memoria, sin usarla */ | |
#include <unistd.h> | |
#include <stdlib.h> | |
#define PAGESIZE 4096 | |
#define SIZE 1212 * PAGESIZE | |
int main() { | |
int 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
last pid: 1681; load averages: 0.02, 0.03, 0.00 up 0+01:53:18 09:35:32 | |
25 processes: 2 running, 22 sleeping, 1 waiting | |
CPU: 2.3% user, 0.0% nice, 1.5% system, 0.0% interrupt, 96.2% idle | |
Mem: 84M Active, 50M Inact, 32M Wired, 4K Cache, 34M Buf, 77M Free | |
Swap: 512M Total, 2668K Used, 509M Free | |
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND | |
1102 jaime 6 20 0 134M 98792K uwait 3:20 0.00% /home/jaime/OperaDownloads/opera-dir/lib/opera/opera -pd /hom | |
820 jaime 1 20 0 69752K 58080K select 0:45 0.10% X -nolisten tcp (Xorg) | |
808 jaime 1 20 0 16376K 7732K select 0:02 0.00% urxvtd -q |