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

Add CLU
(Added Python one liner)
(Add CLU)
Line 208:
12345679012345679012765432098765432098769 111111111111111111113
1234567901234567901238765432098765432098769 1111111111111111111113</pre>
 
=={{header|CLU}}==
<lang clu>ones_plus_three = proc (n: int) returns (int)
r: int := 0
for i: int in int$from_to(1, n) do
r := r*10 + 1
end
return(r*10 + 3)
end ones_plus_three
 
start_up = proc ()
po: stream := stream$primary_output()
for i: int in int$from_to(0, 7) do
n: int := ones_plus_three(i)
nsq: int := n**2
stream$putright(po, int$unparse(n), 8)
stream$puts(po, "^2 = ")
stream$putright(po, int$unparse(nsq), 15)
stream$putl(po, "")
end
end start_up</lang>
{{out}}
<pre> 3^2 = 9
13^2 = 169
113^2 = 12769
1113^2 = 1238769
11113^2 = 123498769
111113^2 = 12346098769
1111113^2 = 1234572098769
11111113^2 = 123456832098769</pre>
 
=={{header|F_Sharp|F#}}==
Line 225 ⟶ 257:
111111113->12345679432098769
</pre>
 
=={{header|Factor}}==
<big>{{math|a(<var>n</var>) &#61; ((10<sup><var>n</var>+1</sup> - 1) / 9 + 2)<sup>2</sup> }}</big>
2,114

edits