16 lines
577 B
Plaintext
16 lines
577 B
Plaintext
/* Predicate functions that checks wether an integer is a Blum integer or not */
|
|
blum_p(n):=lambda([x],length(ifactors(x))=2 and unique(map(second,ifactors(x)))=[1] and mod(ifactors(x)[1][1],4)=3 and mod(ifactors(x)[2][1],4)=3)(n)$
|
|
|
|
/* Function that returns a list of the first len Blum integers */
|
|
blum_count(len):=block(
|
|
[i:1,count:0,result:[]],
|
|
while count<len do (if blum_p(i) then (result:endcons(i,result),count:count+1),i:i+1),
|
|
result)$
|
|
|
|
/* Test cases */
|
|
/* First 50 Blum integers */
|
|
blum_count(50);
|
|
|
|
/* Blum integer number 26828 */
|
|
last(blum_count(26828));
|