First an introduction, what is Primecoin? According to wikipedia:

Primecoin (sign: Ψ; code: XPM) is a peer-to-peer open source cryptocurrency that implements a scientific computing proof-of-work system.
Primecoin uses the finding of long Cunningham chains for proof-of-work. Cunningham chains are used by cryptosystems, including ElGamal.
Also according to wikipedia:
A Cunningham chain is a certain sequence of prime numbers.
Definition: A Cunningham chain of the first kind (1CC) of length
is a sequence of prime numbers
such that for all
Example: (2, 5, 11, 23, 47) is a 1CC of length 5.
Notice that , but instead
Similarly, we define a 2CC
Definition: A Cunningham chain of the second kind (2CC) of length
is a sequence of prime numbers
such that for all
Example: (19, 37, 73) is a 2CC of length 3.
Notice that but instead
This seems to coincide with the primecoin paper, where it says
“A Cunningham chain of the first kind has each prime one more than the double of previous prime in chain, and where Cunningham chain of the second kind has each prime one less than the double of previous prime in chain. A variation of the form is known as bi-twin chain, that is, a chain of twin primes where each twin pair basically doubles the previous twin pair.”
I think my confusion starts with the definition of a bi-twin chain, so I won’t define it. Let’s instead just check the results for the 1CC and the 2CC found by Primecoin.
(*) Edit: At the end of the post everything gets clear.
If I run the following command
listprimerecords 13 2CC
in the Primecoin console, I get as output
[
{
"time" : "2013-09-10 22:57:00 UTC",
"epoch" : 1378853820,
"height" : 159217,
"ismine" : false,
"primedigit" : 94,
"primechain" : "2CC0d.9b948d",
"primeorigin" : "2157379196749861922279323942438489646066518556204460081290289105121926523847387648204577131520",
"primorialform" : "10756750720700195380397697188448178460115725467111771468875842964723844354555016704*31#"
}
]
Notice that what is called “primeorigin” isn’t even a prime number. Let’s call it and think of it as previous to
, then, as we are talkin of a 2CC, it should be that
should be a prime number. But it turns out it isn’t.
So let’s think that maybe 1CC and 2CC are interchanged in Primecoin. In that case it should be that
should be a prime number. And it is! Following we should have
should be a prime number. But it isn’t!
I figured out that if instead we make
…
we get prime numbers for
(Also, this are only 12 primes, not 13 as I thought I was requesting) (**)
Let’s try another: when I run
listprimerecords 12 2CC
I get (between other results)
{
“time” : “2013-12-05 06:53:58 UTC”,
“epoch” : 1386226438,
“height” : 295139,
“ismine” : false,
“primedigit” : 103,
“primechain” : “2CC0c.a4caf9”,
“primeorigin” : “1285764572562607660402926389038420423264315480012212599885081765424391378752917310800826080871198228480”,
“primorialform” : “98279295935033180629959785897200089181968927279639445372368151461888313357086975983616*43#”
}
Again,
isn’t a prime number. And we have
all prime for
(Also, this are only 11 primes, not 12 as I thought I was requesting) (**)
Here I will make a definition
Definition: A Primecoin chain of the first kind (1PC) of length
is a sequence of prime numbers
such that for all
for some
Example: (19, 37, 73) is a 1PC of length 3, with
So it looks like the implementation of Primecoin is mixing a 2CC with a 1PC.
Let’s see what happens with 1CC
listprimerecords 11 1CC
I get (between other results)
{
“time” : “2013-08-03 18:44:12 UTC”,
“epoch” : 1375555452,
“height” : 95569,
“ismine” : false,
“primedigit” : 140,
“primechain” : “1CC0b.0ca375”,
“primeorigin” : “16640727253474004586160688087254796287314713234888194836242582373213323826931605469636261216936400592303991475386891804398184601469085345290”,
“primorialform” : “73853903764168979088206401473739410396455001112581722569026969860983656346568919*151#”
}
This one is mentioned in wikipedia. (for )
Again, “primeorigin” isn’t a prime, let’s call it , and what we really have is
All primes for
(So only 10 primes in total) (**)
Again, I’ll make a definition here
Definition: A Primecoin chain of the second kind (2PC) of length
is a sequence of prime numbers
such that for all
for some
Example: (11, 23, 47) is a 2PC of length 3, with
So it seems the implementation of Primecoin is mixing a 1CC with a 2PC.
This is the wxMaxima code I used to verify this results
(%i1) n : 2157379196749861922279323942438489646066518556204460081290289105121926523847387648204577131520;
(%i2) primep(n);
(%i3) p0: n;
(%i4) p1: 2*p0-1;
(%i5) primep(p1);
(%i6) p1: 2*p0+1;
(%i7) primep(p1);
(%i8) p2: 2*p1+1;
(%i9) primep(p2);
(%i10) p2: 2^2*p0+1;
(%i11) primep(p2);
(%i12) p12: 2^12*p0+1;
(%i13) primep(p12);
(%i14) p0: 1285764572562607660402926389038420423264315480012212599885081765424391378752917310800826080871198228480;
(%i15) p1: 2*p0+1;
(%i16) primep(p1);
(%i17) p2: 2^2*p0+1;
(%i18) primep(p2);
(%i19) p11: 2^11*p0+1;
(%i20) primep(p11);
(%i21) primep(p0-1);
(%i22) p0: 16640727253474004586160688087254796287314713234888194836242582373213323826931605469636261216936400592303991475386891804398184601469085345290;
(%i23) p1: 2*p0-1;
(%i24) primep(p1);
(%i25) p2: 2^2 * p0 – 1;
(%i26) primep(p2);
(%i27) p10: 2^10 * p0 – 1;
(%i28) primep(p10);
(*) Edit: I think I now understand what’s happening here.
Let’s say we have a 1CC
inductively
On the other hand, let’s say we have a 2PC
inductively
Both sequences are equal iff
which can be accomplished by taking
So in some sense, both sequences are equivalent, so that ends the problem.
Similarly a 2CC is equivalent to a 1PC.
(**) Also I understood the “origin” of the chain, and how to correctly calculate the length of the chain. (Extracted from bitcoin magazine):
“For the purposes of Primecoin, the “origin” of a bi-twin chain is defined as the average of the first pair, and for single Cunningham chains the origin is what the average of the first pair would be if the Cunningham chain’s twin also existed”
If you read all this up to down here, and you liked the article, feel free to tip me here (if you didn’t like it or it was all wrong, you can tip too)
Primecoin (XPM) Address: AWCufW28c8AJJzjTs38NWBFZVEkpRm39t4 😉

