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
bits := 32; batchSize := 100; | |
maxQ := -1; | |
for index in [1..batchSize] do | |
q := RandomPrime(bits - 1); | |
if q gt maxQ and IsPrime(2*q + 1) then | |
maxQ := q; | |
print 2*q + 1, q; | |
end if; | |
end for; |
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
bits := 32; batchSize := 100; | |
p := -1; maxQ := -1; | |
for i in [1..batchSize] do | |
p := RandomPrime(bits); | |
phi := EulerPhi(p); | |
factors := Factorization(phi); | |
q, _ := Max([factor[1] : factor in factors]); | |
primitiveCount := EulerPhi(phi); | |
if (q gt maxQ) then | |
maxQ := q; |
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
p := 7; batchSize := 10; | |
for index in [1..batchSize] do | |
p := NextPrime(p); | |
phi := EulerPhi(p); | |
factors := Factorization(phi); | |
primitiveCount := EulerPhi(phi); | |
printf "%o, %o, %o\n", p, factors, primitiveCount; | |
end for; |
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
"""Lyndon.py | |
Algorithms on strings and sequences based on Lyndon words. | |
David Eppstein, October 2011.""" | |
import unittest | |
from Eratosthenes import MoebiusFunction | |
def LengthLimitedLyndonWords(s,n): | |
"""Generate nonempty Lyndon words of length <= n over an s-symbol alphabet. | |
The words are generated in lexicographic order, using an algorithm from |
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
puts ([["daan", "v", "berkel", "1980"],["gmail", "com"]].map {|e| e.join(".")}).join("@") |
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
#! /usr/bin/env perl | |
use strict; | |
use warnings; | |
my $program = <<'EOP'; | |
#! /usr/bin/env perl | |
use strict; | |
use warnings; |
NewerOlder