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
function Alcuin ( n ) { let _n = n , ans ; ans = Math . round ( ( _n * _n ) / 12 ) - Math . floor ( _n / 4 ) * Math . floor ( ( _n + 2 ) / 4 ) ; return ans ; } function solve ( n ) { let i = 0 ; for ( let i = 1 ; i <= n ; i ++ ) { document . write ( Alcuin ( i ) + " " ) ; } } let n = 15 ; solve ( n ) ;