10 lines
397 B
Text
10 lines
397 B
Text
/* Function for repunit numbers */
|
|
repunit(n):=(10^n-1)/9;
|
|
|
|
/* Function that checks if property is satisfied */
|
|
repunit_property(n):=is(mod(repunit(n-1),n)=0);
|
|
|
|
/* Function to list the first n deceptive numbers */
|
|
deceptive_list(n):=block([deceptives:[],count:0,i:5],
|
|
while count<n do (if repunit_property(i) and not primep(i) then (push(i,deceptives),count:count+1),i:i+1),
|
|
reverse(deceptives));
|