power23 [ ] will store pairwise product of elements of power2 and power3 that are <= r
List < int > power23 = new List < int > ( ) ; for ( int x = 0 ; x < power2 . Count ; x ++ ) { for ( int y = 0 ; y < power3 . Count ; y ++ ) { int mul = power2 [ x ] * power3 [ y ] ; if ( mul == 1 ) continue ;