Newmanâ €“ Shanksâ €“ Williams prime | return nth NewmanaShanksaWilliams prime ; Base case ; Recursive step ; Driven Program
def nswp ( n ) : NEW_LINE INDENT if n == 0 or n == 1 : NEW_LINE INDENT return 1 NEW_LINE DEDENT return 2 * nswp ( n - 1 ) + nswp ( n - 2 ) NEW_LINE DEDENT n = 3 NEW_LINE print ( nswp ( n ) ) NEW_LINE