Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Smith-numbers/Maple/smith-numbers.maple
Normal file
16
Task/Smith-numbers/Maple/smith-numbers.maple
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
isSmith := proc(n::posint)
|
||||
local factors, sumofDigits, sumofFactorDigits, x;
|
||||
if isprime(n) then
|
||||
return false;
|
||||
else
|
||||
sumofDigits := add(x, x = convert(n, base, 10));
|
||||
sumofFactorDigits := add(map(x -> op(convert(x, base, 10)), [op(NumberTheory:-PrimeFactors(n))]));
|
||||
return evalb(sumofDigits = sumofFactorDigits);
|
||||
end if;
|
||||
end proc:
|
||||
|
||||
findSmith := proc(n::posint)
|
||||
return select(isSmith, [seq(1 .. n - 1)]);
|
||||
end proc:
|
||||
|
||||
findSmith(10000);
|
||||
Loading…
Add table
Add a link
Reference in a new issue