Newmanâ €“ Shanksâ €“ Williams prime | return nth Newman a Shanks a Williams prime ; Base case ; Recursive step ; Driver Code
< ? php function nswp ( $ n ) { if ( $ n == 0 $ n == 1 ) return 1 ; return 2 * nswp ( $ n - 1 ) + nswp ( $ n - 2 ) ; } $ n = 3 ; echo ( nswp ( $ n ) ) ; ? >