As an assignment I had to develop and algorithm and generate a samples for a given geometric distribution with PMF

![enter image description here](https://i.stack.imgur.com/7Wxdk.png)

Using the inverse transform method, I came up with the following expression for generating the values:

![enter image description here](https://i.stack.imgur.com/FB7m5.png)

Where U represents a value, or n values depending on the size of the sample, drawn from a Unif(0,1) distribution and p is 0.3 as stated in the PMF above.

I have the algorithm, the implementation in R and I already generated QQ Plots to visually assess the adjustment of the empirical values to the theoretical ones (generated with R), i.e., if the generated sample follows indeed the geometric distribution.

Now I wanted to submit the generated sample to a goodness of fit test, namely the Chi-square, yet I'm having trouble doing this in R.