Also (x+1)(x-1) = xx -1 helps if you know the squares 1x3 = 2x2-1, 2x4 = 3x3-1, 3x5 = 4x4-1, 4x6 = 5x5-1, 5x7 = 6x6-1, 6x8 = 7x7-1, 7x9 = 8x8-1, ...
They keep adding to nine. 137×9 = 1233 . 34457×9=310113. When it breaks down: 99x9=891 sums to 18, sums to 9.
You have got to love him as Sulu https://en.m.wikipedia.org/wiki/Star_Trek_Continues https://m.imdb.com/title/tt2732442/mediaviewer/rm1680690432 Edit. The episodes are free, at https://www.startrekcontinues.com
The C++ standard library method std::nth_element states complexity; linear time on average. ( http://en.cppreference.com/w/cpp/algorithm/nth_element ) I wonder if there are other possible implementations?
Also (x+1)(x-1) = xx -1 helps if you know the squares 1x3 = 2x2-1, 2x4 = 3x3-1, 3x5 = 4x4-1, 4x6 = 5x5-1, 5x7 = 6x6-1, 6x8 = 7x7-1, 7x9 = 8x8-1, ...
They keep adding to nine. 137×9 = 1233 . 34457×9=310113. When it breaks down: 99x9=891 sums to 18, sums to 9.
You have got to love him as Sulu https://en.m.wikipedia.org/wiki/Star_Trek_Continues https://m.imdb.com/title/tt2732442/mediaviewer/rm1680690432 Edit. The episodes are free, at https://www.startrekcontinues.com
The C++ standard library method std::nth_element states complexity; linear time on average. ( http://en.cppreference.com/w/cpp/algorithm/nth_element ) I wonder if there are other possible implementations?