float puissance(float x, int n)
{
  float res = 1;

  for (int i=1; i<=n; i++)
  {
    res = res * x;
  }

  return res;
}

float puissance2(float x, int n)
{
  float res = 1;
  int i=1;

  while (i<=n)
  {
    res = res * x;
    i++;
  }

  return res;
}

float puissance3(float x, int n)
{
  float res = 1;
  int i=1;

  if (n==0)
  {
    return res;
  }

  do
  {
    res = res * x;
    i++;
  }
  while (i<=n);

  return res;
}

int factorielle(int n)
{
  int res = 1;

  for (int i=1; i<=n; i++)
  {
    res = res * i;
  }

  return res;
}

boolean estPremier(int x)
{
  int d = 2;

  while ((x % d !=0) && (d<x-1))
  {
    d++;
  }
  if (d!=x-1) //(x % d ==0)
  {
    return false;
  } else
  {
    return true;
  }
}

void setup()
{
  println(estPremier(2));
}
