Print N lines of 4 numbers such that every pair among 4 numbers has a GCD K | Function to print N lines ; Iterate N times to print N lines ; Driver Code
< ? php function printLines ( $ n , $ k ) { for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { echo ( $ k * ( 6 * $ i + 1 ) ) ; echo ( " ▁ " ) ; echo ( $ k * ( 6 * $ i + 2 ) ) ; echo ( " ▁ " ) ; echo ( $ k * ( 6 * $ i + 3 ) ) ; echo ( " ▁ " ) ; echo ( $ k * ( 6 * $ i + 5 ) ) ; echo ( " STRNEWLINE " ) ; } } $ n = 2 ; $ k = 2 ; printLines ( $ n , $ k ) ; ? >