Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -2,7 +2,7 @@ brazilian?: function [n][
|
|||
if n < 7 -> return false
|
||||
if zero? and n 1 -> return true
|
||||
loop 2..n-2 'b [
|
||||
if 1 = size unique digits.base:b n ->
|
||||
if one? unique digits.base:b n ->
|
||||
return true
|
||||
]
|
||||
return false
|
||||
|
|
@ -11,11 +11,11 @@ brazilian?: function [n][
|
|||
printFirstByRule: function [rule,title][
|
||||
print ~"First 20 |title|brazilian numbers:"
|
||||
i: 7
|
||||
found: new []
|
||||
found: []
|
||||
while [20 > size found][
|
||||
if brazilian? i ->
|
||||
'found ++ i
|
||||
do.import rule
|
||||
do rule
|
||||
]
|
||||
print found
|
||||
print ""
|
||||
|
|
|
|||
|
|
@ -1,292 +0,0 @@
|
|||
program brazilianNumbers;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE DELPHI}{$OPTIMIZATION ON,All}
|
||||
{$CODEALIGN proc=32,loop=4}
|
||||
{$ELSE}
|
||||
{$APPTYPE CONSOLE}
|
||||
{$ENDIF}
|
||||
uses
|
||||
SysUtils;
|
||||
|
||||
const
|
||||
//Must not be a prime
|
||||
PrimeMarker = 0;
|
||||
SquareMarker = PrimeMarker + 1;
|
||||
//MAX = 110468;// 1E5 brazilian
|
||||
//MAX = 1084566;// 1E6 brazilian
|
||||
//MAX = 10708453;// 1E7 brazilian
|
||||
//MAX = 106091516;// 1E8 brazilian
|
||||
MAX = 1053421821;// 1E9 brazilian
|
||||
|
||||
var
|
||||
isprime: array of word;
|
||||
|
||||
procedure MarkSmallestFactor;
|
||||
//sieve of erathotenes
|
||||
//but saving the smallest factor
|
||||
var
|
||||
i, j, lmt: NativeUint;
|
||||
begin
|
||||
lmt := High(isPrime);
|
||||
fillWord(isPrime[0], lmt + 1, PrimeMarker);
|
||||
//mark even numbers
|
||||
i := 2;
|
||||
j := i * i;
|
||||
isPrime[j] := SquareMarker;
|
||||
Inc(j, 2);
|
||||
while j <= lmt do
|
||||
begin
|
||||
isPrime[j] := 2;
|
||||
Inc(j, 2);
|
||||
end;
|
||||
//mark 3 but not 2
|
||||
i := 3;
|
||||
j := i * i;
|
||||
isPrime[j] := SquareMarker;
|
||||
Inc(j, 6);
|
||||
while j <= lmt do
|
||||
begin
|
||||
isPrime[j] := 3;
|
||||
Inc(j, 6);
|
||||
end;
|
||||
|
||||
i := 5;
|
||||
while i * i <= lmt do
|
||||
begin
|
||||
if isPrime[i] = 0 then
|
||||
begin
|
||||
j := lmt div i;
|
||||
if not (odd(j)) then
|
||||
Dec(j);
|
||||
while j > i do
|
||||
begin
|
||||
if isPrime[j] = 0 then
|
||||
isPrime[i * j] := i;
|
||||
Dec(j, 2);
|
||||
end;
|
||||
//mark square prime
|
||||
isPrime[i * i] := SquareMarker;
|
||||
end;
|
||||
Inc(i, 2);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure OutFactors(n: NativeUint);
|
||||
var
|
||||
divisor, Next, rest: NativeUint;
|
||||
pot: NativeUint;
|
||||
begin
|
||||
divisor := 2;
|
||||
Next := 3;
|
||||
rest := n;
|
||||
Write(n: 10, ' = ');
|
||||
while (rest <> 1) do
|
||||
begin
|
||||
if (rest mod divisor = 0) then
|
||||
begin
|
||||
Write(divisor);
|
||||
pot := 0;
|
||||
repeat
|
||||
rest := rest div divisor;
|
||||
Inc(pot)
|
||||
until rest mod divisor <> 0;
|
||||
if pot > 1 then
|
||||
Write('^', pot);
|
||||
if rest > 1 then
|
||||
Write('*');
|
||||
end;
|
||||
divisor := Next;
|
||||
Next := Next + 2;
|
||||
// cut condition: avoid many useless iterations
|
||||
if (rest <> 1) and (rest < divisor * divisor) then
|
||||
begin
|
||||
Write(rest);
|
||||
rest := 1;
|
||||
end;
|
||||
end;
|
||||
Write(' ', #9#9#9);
|
||||
end;
|
||||
|
||||
procedure OutToBase(number, base: NativeUint);
|
||||
var
|
||||
BaseDgt: array[0..63] of NativeUint;
|
||||
i, rest: NativeINt;
|
||||
begin
|
||||
OutFactors(number);
|
||||
i := 0;
|
||||
while number <> 0 do
|
||||
begin
|
||||
rest := number div base;
|
||||
BaseDgt[i] := number - rest * base;
|
||||
number := rest;
|
||||
Inc(i);
|
||||
end;
|
||||
while i > 1 do
|
||||
begin
|
||||
Dec(i);
|
||||
Write(BaseDgt[i]);
|
||||
end;
|
||||
writeln(BaseDgt[0], ' to base ', base);
|
||||
end;
|
||||
|
||||
function PrimeBase(number: NativeUint): NativeUint;
|
||||
var
|
||||
lnN: extended;
|
||||
i, exponent, n: NativeUint;
|
||||
begin
|
||||
// primes are only brazilian if 111...11 to base > 2
|
||||
// the count of "1" must be odd , because brazilian primes are odd
|
||||
lnN := ln(number);
|
||||
exponent := 4;
|
||||
//result := exponent.th root of number
|
||||
Result := trunc(exp(lnN*0.25));
|
||||
while result >2 do
|
||||
Begin
|
||||
// calc sum(i= 0 to exponent ) base^i;
|
||||
n := Result + 1;
|
||||
i := 2;
|
||||
repeat
|
||||
Inc(i);
|
||||
n := n*result + 1;
|
||||
until i > exponent;
|
||||
if n = number then
|
||||
EXIT;
|
||||
Inc(exponent,2);
|
||||
Result := trunc(exp(lnN/exponent));
|
||||
end;
|
||||
//not brazilian
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function GetPrimeBrazilianBase(number: NativeUint): NativeUint;
|
||||
//result is base
|
||||
begin
|
||||
// prime of 2^n - 1
|
||||
if (Number and (number + 1)) = 0 then
|
||||
Result := 2
|
||||
else
|
||||
begin
|
||||
Result := trunc(sqrt(number));
|
||||
//most of the brazilian primes are of this type base^2+base+1
|
||||
IF (sqr(result)+result+1) <> number then
|
||||
result := PrimeBase(number);
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetBrazilianBase(number: NativeUInt): NativeUint; inline;
|
||||
begin
|
||||
Result := isPrime[number];
|
||||
if Result > SquareMarker then
|
||||
Result := (number div Result) - 1
|
||||
else
|
||||
begin
|
||||
if Result = SquareMarker then
|
||||
begin
|
||||
if number = 121 then
|
||||
Result := 3
|
||||
else
|
||||
Result := 0;
|
||||
end
|
||||
else
|
||||
Result := GetPrimeBrazilianBase(number);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure First20Brazilian;
|
||||
var
|
||||
i, n, cnt: NativeUInt;
|
||||
begin
|
||||
writeln('first 20 brazilian numbers');
|
||||
i := 7;
|
||||
cnt := 0;
|
||||
while cnt < 20 do
|
||||
begin
|
||||
n := GetBrazilianBase(i);
|
||||
if n <> 0 then
|
||||
begin
|
||||
Inc(cnt);
|
||||
OutToBase(i, n);
|
||||
end;
|
||||
Inc(i);
|
||||
end;
|
||||
writeln;
|
||||
end;
|
||||
|
||||
procedure First33OddBrazilian;
|
||||
var
|
||||
i, n, cnt: NativeUInt;
|
||||
begin
|
||||
writeln('first 33 odd brazilian numbers');
|
||||
i := 7;
|
||||
cnt := 0;
|
||||
while cnt < 33 do
|
||||
begin
|
||||
n := GetBrazilianBase(i);
|
||||
if N <> 0 then
|
||||
begin
|
||||
Inc(cnt);
|
||||
OutToBase(i, n);
|
||||
end;
|
||||
Inc(i, 2);
|
||||
end;
|
||||
writeln;
|
||||
end;
|
||||
|
||||
procedure First20BrazilianPrimes;
|
||||
var
|
||||
i, n, cnt: NativeUInt;
|
||||
begin
|
||||
writeln('first 20 brazilian prime numbers');
|
||||
i := 7;
|
||||
cnt := 0;
|
||||
while cnt < 20 do
|
||||
begin
|
||||
IF isPrime[i] = PrimeMarker then
|
||||
Begin
|
||||
n := GetBrazilianBase(i);
|
||||
if n <> 0 then
|
||||
begin
|
||||
Inc(cnt);
|
||||
OutToBase(i, n);
|
||||
end;
|
||||
end;
|
||||
Inc(i);
|
||||
end;
|
||||
writeln;
|
||||
end;
|
||||
|
||||
var
|
||||
T1, T0: TDateTime;
|
||||
i, n, cnt, lmt: NativeUInt;
|
||||
begin
|
||||
lmt := MAX;
|
||||
setlength(isPrime, lmt + 1);
|
||||
MarkSmallestFactor;
|
||||
|
||||
First20Brazilian;
|
||||
First33OddBrazilian;
|
||||
First20BrazilianPrimes;
|
||||
|
||||
Write('count brazilian numbers up to ', lmt, ' = ');
|
||||
T0 := now;
|
||||
i := 7;
|
||||
cnt := 0;
|
||||
n := 0;
|
||||
|
||||
while (i <= lmt) do
|
||||
begin
|
||||
Inc(n, Ord(isPrime[i] = PrimeMarker));
|
||||
if GetBrazilianBase(i) <> 0 then
|
||||
Inc(cnt);
|
||||
Inc(i);
|
||||
end;
|
||||
|
||||
T1 := now;
|
||||
|
||||
writeln(cnt);
|
||||
writeln('Count of primes ', n: 11+13);
|
||||
writeln((T1 - T0) * 86400 * 1000: 10: 0, ' ms');
|
||||
|
||||
setlength(isPrime, 0);
|
||||
end.
|
||||
|
|
@ -1,56 +1,54 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">same_digits</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">b</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">f</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">,</span><span style="color: #000000;">b</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">floor</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">/</span><span style="color: #000000;">b</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">while</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">></span><span style="color: #000000;">0</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">,</span><span style="color: #000000;">b</span><span style="color: #0000FF;">)!=</span><span style="color: #000000;">f</span> <span style="color: #008080;">then</span> <span style="color: #008080;">return</span> <span style="color: #004600;">false</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">floor</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">/</span><span style="color: #000000;">b</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #004600;">true</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
with javascript_semantics
|
||||
function same_digits(integer n, b)
|
||||
integer f = remainder(n,b)
|
||||
n = floor(n/b)
|
||||
while n>0 do
|
||||
if remainder(n,b)!=f then return false end if
|
||||
n = floor(n/b)
|
||||
end while
|
||||
return true
|
||||
end function
|
||||
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">is_brazilian</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">>=</span><span style="color: #000000;">7</span> <span style="color: #008080;">then</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span> <span style="color: #008080;">return</span> <span style="color: #004600;">true</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">b</span><span style="color: #0000FF;">=</span><span style="color: #000000;">2</span> <span style="color: #008080;">to</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">-</span><span style="color: #000000;">2</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">same_digits</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">,</span><span style="color: #000000;">b</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">then</span> <span style="color: #008080;">return</span> <span style="color: #004600;">true</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #004600;">false</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
function is_brazilian(integer n)
|
||||
if n>=7 then
|
||||
if remainder(n,2)=0 then return true end if
|
||||
for b=2 to n-2 do
|
||||
if same_digits(n,b) then return true end if
|
||||
end for
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
<span style="color: #008080;">constant</span> <span style="color: #000000;">kinds</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #008000;">" "</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">" odd "</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">" prime "</span><span style="color: #0000FF;">}</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">kinds</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"First 20%sBrazilian numbers:\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">kinds</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">]})</span>
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">c</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">7</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">p</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">4</span>
|
||||
<span style="color: #008080;">while</span> <span style="color: #004600;">true</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">is_brazilian</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">then</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%d "</span><span style="color: #0000FF;">,</span><span style="color: #000000;">n</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">c</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">c</span><span style="color: #0000FF;">==</span><span style="color: #000000;">20</span> <span style="color: #008080;">then</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\n\n"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">exit</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #008080;">switch</span> <span style="color: #000000;">i</span>
|
||||
<span style="color: #008080;">case</span> <span style="color: #000000;">1</span><span style="color: #0000FF;">:</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span>
|
||||
<span style="color: #008080;">case</span> <span style="color: #000000;">2</span><span style="color: #0000FF;">:</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">2</span>
|
||||
<span style="color: #008080;">case</span> <span style="color: #000000;">3</span><span style="color: #0000FF;">:</span> <span style="color: #000000;">p</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span><span style="color: #0000FF;">;</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">get_prime</span><span style="color: #0000FF;">(</span><span style="color: #000000;">p</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">switch</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
constant kinds = {" ", " odd ", " prime "}
|
||||
for i=1 to length(kinds) do
|
||||
printf(1,"First 20%sBrazilian numbers:\n", {kinds[i]})
|
||||
integer c = 0, n = 7, p = 4
|
||||
while true do
|
||||
if is_brazilian(n) then
|
||||
printf(1,"%d ",n)
|
||||
c += 1
|
||||
if c==20 then
|
||||
printf(1,"\n\n")
|
||||
exit
|
||||
end if
|
||||
end if
|
||||
switch i
|
||||
case 1: n += 1
|
||||
case 2: n += 2
|
||||
case 3: p += 1; n = get_prime(p)
|
||||
end switch
|
||||
end while
|
||||
end for
|
||||
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">7</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">c</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">0</span>
|
||||
<span style="color: #004080;">atom</span> <span style="color: #000000;">t0</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">time</span><span style="color: #0000FF;">(),</span> <span style="color: #000000;">t1</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">time</span><span style="color: #0000FF;">()+</span><span style="color: #000000;">1</span>
|
||||
<span style="color: #008080;">while</span> <span style="color: #000000;">c</span><span style="color: #0000FF;"><</span><span style="color: #000000;">100000</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #7060A8;">platform</span><span style="color: #0000FF;">()!=</span><span style="color: #004600;">JS</span> <span style="color: #008080;">and</span> <span style="color: #7060A8;">time</span><span style="color: #0000FF;">()></span><span style="color: #000000;">t1</span> <span style="color: #008080;">then</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"checking %d [count:%d]...\r"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">n</span><span style="color: #0000FF;">,</span><span style="color: #000000;">c</span><span style="color: #0000FF;">})</span>
|
||||
<span style="color: #000000;">t1</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">time</span><span style="color: #0000FF;">()+</span><span style="color: #000000;">1</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #000000;">c</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">is_brazilian</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">n</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"The %,dth Brazilian number: %d\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">c</span><span style="color: #0000FF;">,</span><span style="color: #000000;">n</span><span style="color: #0000FF;">-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">})</span>
|
||||
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">elapsed</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">time</span><span style="color: #0000FF;">()-</span><span style="color: #000000;">t0</span><span style="color: #0000FF;">)</span>
|
||||
<!--
|
||||
integer n = 7, c = 0
|
||||
atom t0 = time(), t1 = time()+1
|
||||
while c<100000 do
|
||||
if platform()!=JS and time()>t1 then
|
||||
printf(1,"checking %d [count:%d]...\r",{n,c})
|
||||
t1 = time()+1
|
||||
end if
|
||||
c += is_brazilian(n)
|
||||
n += 1
|
||||
end while
|
||||
printf(1,"The %,dth Brazilian number: %d\n", {c,n-1})
|
||||
?elapsed(time()-t0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue