CKOne

40 Reputation

2 Badges

15 years, 28 days

MaplePrimes Activity


These are questions asked by CKOne

I have used bubble sort to put my list in order but now i need help to rearrange the list.

For example l:=[2,2,2,3,4,5,1,3,7,8,9]
Bubble sort:= [1,2,2,2,3,3,4,5,7,8,9]

What i want to do is do, smallest&largest,next smallest & next largest
Like this - [1,9,2,8,2,7,2,5,3,4,3]
So as you can see its been rearranged so that their all next to each other.

Any help would be great.

i have two lists, and i want to merge them together and then put them in order.
Can any1 help me?

[[1,15,21],[5,7,33]]

 

Could someone please help me with this procedure please. Testing weather numberss are prime of not.

restart:
Miller_Rabin:=proc(a,n)
local minus1, d, test,r,p,q,i,w:
minus1:=n-1:
d:=minus1:

while ((d mod 2) = 0) do
d:=d/2:
end do;

test:=Power(a,d) mod n:
r:=minus1/d:
p:=ifactor(r):
q:=op(2,p):
for i from 0 to q do
w:=a^(2^(i)*d) mod n:
od:

if (test = 1) and ( w = minus1 or w = 1) then

Page 1 of 1