Data update
This commit is contained in:
parent
5af6d93694
commit
796d366b97
455 changed files with 7413 additions and 1900 deletions
12
Task/Giuga-numbers/Maxima/giuga-numbers.maxima
Normal file
12
Task/Giuga-numbers/Maxima/giuga-numbers.maxima
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/* Predicate function that checks wether an integer is a Giuga number or not */
|
||||
giugap(n):=if not primep(n) then block(ifactors(n),map(lambda([x],mod((n/x)-1,x)=0),map(first,%%)),
|
||||
if length(unique(%%))=1 and apply(lhs,unique(%%))=0 then true)$
|
||||
|
||||
/* Function that returns a list of the first len Giuga integers */
|
||||
giuga_count(len):=block(
|
||||
[i:1,count:0,result:[]],
|
||||
while count<len do (if giugap(i) then (result:endcons(i,result),count:count+1),i:i+1),
|
||||
result)$
|
||||
|
||||
/* Test case */
|
||||
giuga_count(4);
|
||||
Loading…
Add table
Add a link
Reference in a new issue