Show the (decimal) value of a number of 1s appended with a 3, then squared: Difference between revisions

(→‎{{header|jq}}: n==100 ...)
Line 410:
7 11111113 123456832098769
</pre>
'''For 100 <= n <= 105'''
 
Encoding "123456790" as "A", "987654320" as Z", and lastly "9876" as "N":
<lang jq>range(100; 106) as $n
| ((("1"*$n) + "3") | tonumber) as $number
| ($n|lpad(4)) + " "
+ ($number|power(2)|tostring| gsub("123456790";"A") | gsub("987654320";"Z") | gsub("9876";"N") | lpad(40))
</lang>
{{out}}
<pre>
100 AAAAAAAAAAA1654320ZZZZZZZZZZN9
101 AAAAAAAAAAA127654320ZZZZZZZZZZN9
102 AAAAAAAAAAA12387654320ZZZZZZZZZZN9
103 AAAAAAAAAAA1234ZZZZZZZZZZZN9
104 AAAAAAAAAAA123460ZZZZZZZZZZZN9
105 AAAAAAAAAAA12345720ZZZZZZZZZZZN9
</pre>
 
=={{header|Julia}}==
2,461

edits