Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Pernicious-numbers/Maple/pernicious-numbers.maple
Normal file
27
Task/Pernicious-numbers/Maple/pernicious-numbers.maple
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
ispernicious := proc(n::posint)
|
||||
return evalb(isprime(rhs(Statistics:-Tally(StringTools:-Explode(convert(convert(n, binary), string)))[-1])));
|
||||
end proc;
|
||||
|
||||
print_pernicious := proc(n::posint)
|
||||
local k, count, list_num;
|
||||
count := 0;
|
||||
list_num := [];
|
||||
for k while count < n do
|
||||
if ispernicious(k) then
|
||||
count := count + 1;
|
||||
list_num := [op(list_num), k];
|
||||
end if;
|
||||
end do;
|
||||
return list_num;
|
||||
end proc:
|
||||
|
||||
range_pernicious := proc(n::posint, m::posint)
|
||||
local k, list_num;
|
||||
list_num := [];
|
||||
for k from n to m do
|
||||
if ispernicious(k) then
|
||||
list_num := [op(list_num), k];
|
||||
end if;
|
||||
end do;
|
||||
return list_num;
|
||||
end proc:
|
||||
Loading…
Add table
Add a link
Reference in a new issue