Jump to content

Kaprekar numbers: Difference between revisions

Added 11l
m (C++/ useless parentheses)
(Added 11l)
Line 47:
*   [[Casting out nines]]
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>F k(n)
V n2 = String(Int64(n) ^ 2)
L(i) 0 .< n2.len
V a = I i > 0 {Int(n2[0 .< i])} E 0
V b = Int(n2[i ..])
I b != 0 & a + b == n
R 1B
R 0B
 
print((1..9999).filter(x -> k(x)))
print((1..999999).filter(x -> k(x)).len)</lang>
 
{{out}}
<pre>
[1, 9, 45, 55, 99, 297, 703, 999, 2223, 2728, 4879, 4950, 5050, 5292, 7272, 7777, 9999]
54
</pre>
 
=={{header|360 Assembly}}==
1,481

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.