Post Reply 
Speed of HP-15C LE - and it's capabilities
05-25-2014, 08:36 AM (This post was last modified: 05-25-2014 08:39 AM by Tugdual.)
Post: #16
RE: Speed of HP-15C LE - and it's capabilities
Tested the same problem with the Hp Prime.
Ease of development: much much easier than 34s or 15C, no question about that. Using lists and a few other convenient functions took me less than 1h while on the 34s it took me days of painful debugging. Also when you read the source code, there is a chance that you understand something while the 34s and 15c are quite challenging.

Speed: Prime is the big big winner. 1'51s to find the result! Amazing. You cannot even compare with old gen calculators.

Comments: here again the Prime demonstrates how powerful it is. Still I would use a 34s or 15c on a daily base. Definitely a matter of concept. The Prime seems to be lost somewhere in between a small computer and a calculator, demonstrating a lot of power and programming ease but not convenient for daily calculations.

Code:
next_permutation();

EXPORT permutations()
begin
   local t,v;

   // Initializes the list of digits
   makelist(A,A,1,9,1)▶L1;

   print;
   ticks()▶t;
   repeat
      // Evaluates one combination
      L1(1)/(10*L1(2)+L1(3))+L1(4)/(10*L1(5)+L1(6))+L1(7)/(10*L1(8)+L1(9))▶v;
      if 1-v==0 then 
         print(concat((ticks()-t)/1000,L1));
      end;
   until next_permutation()==0;
END;

// gets next permutation
next_permutation()
begin
LOCAL i,j,k,v;

9▶i;
while(1) do
   i▶j;
   i-1▶i;
   if L1(i)<L1(j) then
      9▶k;
      while(L1(i) >= L1(k)) do k-1▶k; end;
      // swaps item i & k
      L1(k)▶v;  
      L1(i)▶L1(k);
      v▶L1(i);
      // reverse from j to end
      concat(sub(L1,1,j-1), reverse(sub(L1,j,9)))▶L1;
      return 1;
   end;
   if i==1 then
      reverse(L1)▶L1;
      return 0;
   end;
end; // while
end;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Speed of HP-15C LE - and it's capabilities - Tugdual - 05-25-2014 08:36 AM



User(s) browsing this thread: 1 Guest(s)