From 8aed992163d700f143291757f0f0864f9ab90cea Mon Sep 17 00:00:00 2001 From: Sibasish-Padhy <70088281+Sibasish-Padhy@users.noreply.github.com> Date: Sun, 21 Mar 2021 00:53:34 +0530 Subject: [PATCH] recaman sequence here is the recaman sequence coded in c++.please do have a look for further potential improvements.I am always open for suggestions --- assets/simulations/recaman sequence.cpp | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 assets/simulations/recaman sequence.cpp diff --git a/assets/simulations/recaman sequence.cpp b/assets/simulations/recaman sequence.cpp new file mode 100644 index 0000000..e7bcb51 --- /dev/null +++ b/assets/simulations/recaman sequence.cpp @@ -0,0 +1,33 @@ +int recaman(int n) +{ + //Create an array to store terms + int arr[n]; + + //first term of the sequence is always 0= base case + arr[0]=0; + printf("%d ",arr[0]); + //use the recursive formula + + for (int i=1;i