The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
ifactors Test Problem
09-06-2017, 02:18 PM
Post: #1
ifactors Test Problem
I'm trying to create an is_prime function:

Code:
EXPORT is_prime(X)
begin
  if dim(ifactors(X))=={2} then
    return true;
  else
    return false;
  end;
end;

dim(ifactors(7))

returns {2} but when I call is_prime(7), I get Error: Bad argument type.

I tried with both upper and lowercase X and I tried the 2 both in and out of braces.

What am I doing wrong?

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
ifactors Test Problem - toml_12953 - 09-06-2017 02:18 PM
RE: ifactors Test Problem - Helge Gabert - 09-06-2017, 05:16 PM
RE: ifactors Test Problem - toml_12953 - 09-06-2017, 07:03 PM
RE: ifactors Test Problem - Tim Wessman - 09-06-2017, 07:10 PM
RE: ifactors Test Problem - toml_12953 - 09-06-2017, 10:12 PM
RE: ifactors Test Problem - Helge Gabert - 09-06-2017, 08:13 PM
RE: ifactors Test Problem - Helge Gabert - 09-07-2017, 04:45 PM



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