1 | initial version |

Here is a more or less direct translation:

```
def f(n,p):
d = ceil(log(2)/log(10)*(n-1))
s = GF(p)(2)^(n-1)
t = s.lift()^d
u = GF(p)((2*s-1)*t + s - 1).lift()
return u
v = set(srange(100000,101000+1))
for q in primes(10^7):
z = next((m for m in v if f(m,q) == 0), None)
if z is not None:
v -= set([z])
print q, ' ', len(str(z)), ' ', len(v)
```

It seems unnecessary (in Sage, at least) to lift `s`

in the definition of `t`

. More efficient would be:

```
t = s^d
u = ((2*s-1)*t + s - 1).lift()
```

2 | No.2 Revision |

Here is a more or less direct translation:

```
def f(n,p):
d = ceil(log(2)/log(10)*(n-1))
s = GF(p)(2)^(n-1)
t = s.lift()^d
u = GF(p)((2*s-1)*t + s - 1).lift()
return u
v = set(srange(100000,101000+1))
for q in primes(10^7):
z =
```~~next((m ~~[m for m in v if f(m,q) == ~~0), None)
~~0]
if ~~z is not None:
~~len(z) > 0:
v -= ~~set([z])
~~set(z)
print q, ' ', ~~len(str(z)), ~~len(z), ' ', len(v)

It seems unnecessary (in Sage, at least) to lift `s`

in the definition of `t`

. More efficient would be:

```
t = s^d
u = ((2*s-1)*t + s - 1).lift()
```

3 | No.3 Revision |

Here is a more or less direct translation:

```
def f(n,p):
d = ceil(log(2)/log(10)*(n-1))
s = GF(p)(2)^(n-1)
t =
```~~s.lift()^d
~~GF(p)(10)^d
u = ~~GF(p)((2*s-1)*t ~~((2*s-1)*t + s - 1).lift()
return u
v = set(srange(100000,101000+1))
for q in primes(10^7):
z = [m for m in v if f(m,q) == 0]
if len(z) > 0:
v -= set(z)
print q, ' ', len(z), ' ', len(v)

It seems unnecessary (in Sage, at least) to lift `s`

in the definition of `t`

. More efficient would be:

```
t = s^d
u = ((2*s-1)*t + s - 1).lift()
```

4 | No.4 Revision |

Here is a more or less direct translation:

```
def f(n,p):
d = ceil(log(2)/log(10)*(n-1))
s = GF(p)(2)^(n-1)
t = GF(p)(10)^d
u = ((2*s-1)*t + s - 1).lift()
return u
v = set(srange(100000,101000+1))
for q in primes(10^7):
z = [m for m in v if f(m,q) == 0]
if len(z) > 0:
v -= set(z)
print q,
```~~' ', ~~len(z), ~~' ', ~~len(v)

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.