title: Calculate Area Tangent Circumferences - Prolog
body: <p>I have the following function that calculates an area.</p>
  
  <p>It receives three parameters, the first is an n representing the number of cases, the 2nd representing the radio of circumferences, and the 3rd is l giving me back the result.</p>
  
  <p>The problem I have is that when the 1st input is greater than 1 it does not work.</p>
  
  <p>This my code:</p>
  
  <pre><code>as(1, [X], A) :-
     A is (sqrt(3.0) * (X*X)) - (3.14 * (X*X))/2.
  as(N, [H|_T], A) :-
     A is (sqrt(3.0) * (H*H)) - (3.14 * (H*H))/2,
     N1 is N-1,
     as(N1-1, T, A).     
  </code></pre>
  
  <p>An example of how it should work is:</p>
  
  <pre><code>?- as(4, [1,1,1,1], R).
  R = 0.162050807568877130000 ;
  R = 0.162050807568877130000 ;
  R = 0.162050807568877130000 ;
  R = 0.162050807568877130000.
  </code></pre>
  
  <p>If you could help me, I would be grateful ...</p>