Power3 Playing with digits Some numbers have funny properties. For example: 89 --> 8¹ + 9² = 89 * 1 695 --> 6² + 9³ + 5⁴= 1390 = 695 * 2 46288 --> 4³ + 6⁴+ 2⁵ + 8⁶ + 8⁷ = 2360688 = 46288 * 51 Given a positive integer n written as abcd... (a, b, c, d... being digits) and a positive integer p we want to find a positive integer k, if it exists, such that the sum of the digits of n taken to the successive powers of p is equal.. 2022. 8. 15. SQL Basics: Raise to the Power Given the following table 'decimals': decimals table schema id number1 number2 Return a table with a single column result which is the output of number1 raised to the power of number2. Solution: SELECT POWER(number1, number2) as result FROM decimals The 'POWER' function returns the value raised to the power of the first argument by the second argument. 2022. 6. 9. Easy SQL: Square Root and Log Given the following table 'decimals': ** decimals table schema ** id number1 number2 Return a table with two columns (root, log) where the values in root are the square root of those provided in number1 and the values in log are changed to a base 10 logarithm from those in number2. Solution: SELECT SQRT(number1) AS root, LOG(number2) FROM decimals; SQRT is a function that finds the square root. .. 2022. 5. 17. 이전 1 다음