42 lines
847 B
Plaintext
42 lines
847 B
Plaintext
with(NumberTheory):
|
|
with(ArrayTools):
|
|
|
|
squareFree := proc(n::integer)
|
|
if mul(PrimeFactors(n)) = n then return true;
|
|
else return false; end if;
|
|
return true;
|
|
end proc:
|
|
|
|
sfintegers := Array([]):
|
|
|
|
for count from 1 to 145 do
|
|
if squareFree(count) then Append(sfintegers, count); end if;
|
|
end do:
|
|
|
|
print(sfintegers):
|
|
|
|
sfintegers := Array([]):
|
|
|
|
for count from 10^12 to 10^12+145 do
|
|
if squareFree(count) then Append(sfintegers, count); end if;
|
|
end do:
|
|
|
|
print(sfintegers):
|
|
|
|
sfgroups := Array([]):
|
|
sfcount := 0:
|
|
|
|
for number from 1 to 100 do
|
|
if squareFree(number) then sfcount += 1: end if:
|
|
end do:
|
|
Append(sfgroups, sfcount):
|
|
|
|
for expon from 3 to 6 do
|
|
for number from 10^(expon - 1) to 10^expon do
|
|
if squareFree(number) then sfcount += 1: end if:
|
|
end do:
|
|
Append(sfgroups, sfcount):
|
|
end do:
|
|
|
|
seq(cat(sfgroups[i], " from 1 to ", 10^(i+1)), i = 1..5);
|