Newmanâ €“ Shanksâ €“ Williams prime | return nth Newman - Shanks - Williams prime ; Base case ; Recursive step ; Driver code
function nswp ( n ) { if ( n == 0 n == 1 ) return 1 ; return 2 * nswp ( n - 1 ) + nswp ( n - 2 ) ; } let n = 3 ; document . write ( nswp ( n ) ) ;