Alcuin 's Sequence | CPP program for Alcuin 's Sequence ; find the nth term of Alcuin 's sequence ; return the ans ; print first n terms of Alcuin number ; display the number ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int Alcuin ( int n ) { double _n = n , ans ; ans = round ( ( _n * _n ) / 12 ) - floor ( _n / 4 ) * floor ( ( _n + 2 ) / 4 ) ; return ans ; } void solve ( int n ) { int i = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { cout << Alcuin ( i ) << " , ▁ " ; } } int main ( ) { int n = 15 ; solve ( n ) ; return 0 ; }