Numbers in base-16 representation that cannot be written with decimal digits: Difference between revisions

m
(added Arturo)
m (→‎{{header|Wren}}: Minor tidy)
(4 intermediate revisions by 4 users not shown)
Line 366:
254
255</pre>
 
=={{header|BQN}}==
<syntaxhighlight lang="bqn">∾⟜(16⊸×⊸+⌜˜) 10+↕6</syntaxhighlight>
{{out}}
<pre>┌─
╵ 10 11 12 13 14 15
170 171 172 173 174 175
186 187 188 189 190 191
202 203 204 205 206 207
218 219 220 221 222 223
234 235 236 237 238 239
250 251 252 253 254 255
┘</pre>
 
=={{header|C}}==
Line 388 ⟶ 401:
10 11 12 13 14 15 26 27 28 29 30 31 42 43 44 45 46 47 58 59 60 61 62 63 74 75 76 77 78 79 90 91 92 93 94 95 106 107 108 109 110 111 122 123 124 125 126 127 138 139 140 141 142 143 154 155 156 157 158 159 170 171 172 173 174 175 186 187 188 189 190 191 202 203 204 205 206 207 218 219 220 221 222 223 234 235 236 237 238 239 250 251 252 253 254 255
</pre>
 
=={{header|C++}}==
<syntaxhighlight lang="cpp">
Line 660 ⟶ 674:
254
255</pre>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
 
 
<syntaxhighlight lang="Delphi">
 
function HasNoBase10(N: integer): boolean;
{Test N for decimal digits in hex string}
var I: integer;
var S: string;
begin
Result:=False;
S:=Format('%x',[N]);
for I:=1 to Length(S) do
if S[I] in ['0'..'9'] then exit;
Result:=True;
end;
 
 
 
procedure ShowNoBase10inHex(Memo: TMemo);
var I,Cnt: integer;
var S: string;
begin
Cnt:=0;
for I:=0 to 500-1 do
if HasNoBase10(I) then
begin
Inc(Cnt);
S:=S+Format('%8D',[I]);
If (Cnt mod 5)=0 then S:=S+#$0D#$0A;
end;
Memo.Lines.Add('Count='+IntToStr(Cnt));
Memo.Lines.Add(S);
end;
 
 
</syntaxhighlight>
{{out}}
<pre>
Count=42
10 11 12 13 14
15 170 171 172 173
174 175 186 187 188
189 190 191 202 203
204 205 206 207 218
219 220 221 222 223
234 235 236 237 238
239 250 251 252 253
254 255
</pre>
 
 
=={{header|F_Sharp|F#}}==
Line 1,219 ⟶ 1,287:
Found 42 numbers
done...
</pre>
 
=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.7}}
≪ { 0 10 11 12 13 14 15 } → abc
≪ { }
1 7 '''FOR''' a 1 7 '''FOR''' b 2 7 '''FOR''' c
abc a GET 256 * abc b GET 16 * + abc c GET +
'''IF''' DUP 500 ≤ '''THEN''' + '''ELSE''' DROP '''END'''
'''NEXT NEXT NEXT'''
≫ ≫ ''''TASK'''' STO
{{out}}
<pre>
1: { 10 11 12 13 14 15 170 171 172 173 174 175 186 187 188 189 190 191 202 203 204 205 206 207 218 219 220 221 222 223 234 235 236 237 238 239 250 251 252 253 254 255 }
</pre>
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">p (0..500).select{|n| n.digits(16).all?{|d| d > 9} }</syntaxhighlight>
{{out}}
<pre>
[10, 11, 12, 13, 14, 15, 170, 171, 172, 173, 174, 175, 186, 187, 188, 189, 190, 191, 202, 203, 204, 205, 206, 207, 218, 219, 220, 221, 222, 223, 234, 235, 236, 237, 238, 239, 250, 251, 252, 253, 254, 255]
</pre>
 
Line 1,264 ⟶ 1,353:
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Conv, Fmt
var decimal = "0123456789"
9,485

edits