Check if a number is divisible by 17 using bitwise operators | function to check recursively if the number is divisible by 17 or not ; if n = 0 or n = 17 then yes ; if n is less then 17 , not divisible by 17 ; reducing the number by floor ( n / 16 ) - n % 16 ; Driver Code
< ? php function isDivisibleby17 ( $ n ) { if ( $ n == 0 $ n == 17 ) return true ; if ( $ n < 17 ) return false ; return isDivisibleby17 ( ( int ) ( $ n >> 4 ) - ( int ) ( $ n & 15 ) ) ; } $ n = 35 ; if ( isDivisibleby17 ( $ n ) ) echo $ n . " ▁ is ▁ divisible ▁ by ▁ 17" ; else echo $ n . " ▁ is ▁ not ▁ divisible ▁ by ▁ 17" ; ? >