[seqfan] What is the connection between the Wilson primes and the Wieferich primes?

Peter Luschny peter.luschny at gmail.com
Thu Jul 17 01:05:59 CEST 2014


What is the connection between the Wilson primes (A007540)
and the Wieferich primes (A001220)?

Consider the function (Sage):

def WWP(f, r, n):
    return filter(lambda p: p.divides((f(p-1)+r(p))/p), list(primes(1, n)))

Setting f the factorial function and r the function n -> 1
then WWP(f, r, 3600) will return [5, 13, 563].

Setting f the swinging factorial and r the function n -> -(-1)^binomial(n,2)
then WWP(f, r, 3600) will return [1093, 3511].

Recall the swinging factorial A056040, with Sage:

@CachedFunction
def sw_factorial(n):
    if n == 0: swf = 1
    elif is_odd(n): swf = sw_factorial(n-1)*n
    else: swf = 4*sw_factorial(n-1)/n
    return swf

I am not sure: Is this a trivial, easily explained observation or this a
non-obvious relation? Since there are so many prime number experts on
this list I certainly will know soon.

Peter



More information about the SeqFan mailing list