+ 10

[challenge] calculate squares between 41 and 59 ---mental arithmetic

The squares ot these numbers (num) are easy 25 + (num -50) and num**2 as 2digit example: 53**2 25 + 3 =28 3**2 = 9 --> 2809 example: 42**2 25-8 = 17 8**2 = 64 -->1764 find out how to adapt that "trick" for squares in [35,65]and print the way how to calculate for that numbers similiar to examples. all weapons welcome. have fun

4th Feb 2018, 10:22 AM
Oma Falk
Oma Falk - avatar
12 Respostas
+ 5
@vijay full power, if last digit is 1: 41 4**2|2*4|1 = 1681 71 7**2|2*7|1 =49|14|1 = 5041
4th Feb 2018, 12:43 PM
Oma Falk
Oma Falk - avatar
+ 5
Example solution for 41 -59 https://code.sololearn.com/cAbXqSBHvF7b
4th Feb 2018, 5:06 PM
Oma Falk
Oma Falk - avatar
+ 4
@xdeath: I mean a kind of list 37**2 = ... :25+13 and 13**2 ...last step... for all squares in[35,65] the exact output is free but should demonstrate the "trick" no userinput required edit: why not user input? user input a number and output explenation how to calculate, challenges are ment as inspiration
4th Feb 2018, 10:50 AM
Oma Falk
Oma Falk - avatar
+ 4
@xdeath sure: find all squares up to 10000 where each digit occurs not more than 1 time. example 12* 12 = 144 not valid.... 4 occurs twice 13 * 13 = 169 valid no double digits
4th Feb 2018, 4:30 PM
Oma Falk
Oma Falk - avatar
+ 3
do you mean a system which will take user input and square it?
4th Feb 2018, 10:44 AM
xdeathbossx
+ 2
I'm new to coding is there a simpler challenge I could try?
4th Feb 2018, 12:56 PM
xdeathbossx
+ 2
@Donna wow nice code its compact and fast.I'm more of a JavaScript coder but still that's a fantastic code.works well too.
4th Feb 2018, 2:21 PM
xdeathbossx
+ 1
Also, there is another method for all two digit numbers. suppose the number is 63. 1) 3*3 = 9 2) 2*6*3 = 36 ...keep 6 and pass 3 to the next part. 3) 6*6 = 36 +3 = 39 result = 3969 second number 56 1) 6*6 = 36 ..keep 6 n pass 3 to next 2) 2* 5*6= 60+ 3= 63..keep 3 3) 5*5 = 25 + 6= 31 result = 3136 https://code.sololearn.com/cAQ2344TVu27/?ref=app
4th Feb 2018, 12:09 PM
Vijay
Vijay - avatar
+ 1
@oma..ja, gut Abkürzung👍
4th Feb 2018, 12:59 PM
Vijay
Vijay - avatar