Eban numbers: Difference between revisions

Content added Content deleted
(Eban numbers en FreeBASIC)
Line 116: Line 116:
eban numbers up to an including 1000000000:
eban numbers up to an including 1000000000:
count = 7999</pre>
count = 7999</pre>

=={{header|FreeBASIC}}==
<lang freebasic>
' Eban_numbers
' Un número eban es un número que no tiene la letra e cuando el número está escrito en inglés.
' O más literalmente, los números escritos que contienen la letra e están prohibidos.
'
' Usaremos la versión americana de los números de ortografía (a diferencia de los británicos).
' 2000000000 son dos billones, no dos millardos (mil millones).
'

Data 2, 1000, 1
Data 1000, 4000, 1
Data 2, 10000, 0
Data 2, 100000, 0
Data 2, 1000000, 0
Data 2, 10000000, 0
Data 2, 100000000, 0
Data 0, 0, 0

Dim As Double tiempo = Timer
Dim As Integer start, ended, printable, count
Dim As Long i, b, r, m, t
Do
Read start, ended, printable
If start = 0 Then Exit Do
If start = 2 Then
Print "eban numbers up to and including"; ended; ":"
Else
Print "eban numbers between "; start; " and "; ended; " (inclusive):"
End If
count = 0
For i = start To ended Step 2
b = Int(i / 1000000000)
r = (i Mod 1000000000)
m = Int(r / 1000000)
r = (i Mod 1000000)
t = Int(r / 1000)
r = (r Mod 1000)
If m >= 30 And m <= 66 Then m = (m Mod 10)
If t >= 30 And t <= 66 Then t = (t Mod 10)
If r >= 30 And r <= 66 Then r = (r Mod 10)
If b = 0 Or b = 2 Or b = 4 Or b = 6 Then
If m = 0 Or m = 2 Or m = 4 Or m = 6 Then
If t = 0 Or t = 2 Or t = 4 Or t = 6 Then
If r = 0 Or r = 2 Or r = 4 Or r = 6 Then
If printable Then Print i;
count += 1
End If
End If
End If
End If
Next i
If printable Then Print
Print "count = "; count & Chr(10)
Loop
tiempo = Timer - tiempo
Print "Run time: " & (tiempo) & " seconds."
End
</lang>
{{out}}
<pre>
eban numbers up to and including 100:
2 4 6 30 32 34 36 40 42 44 46 50 52 54 56 60 62 64 66
count = 19

eban numbers between 1000 and 4000 (inclusive):
2000 2002 2004 2006 2030 2032 2034 2036 2040 2042 2044 2046 2050 2052 2054 2056 2060 2062 2064 2066 4000
count = 21

eban numbers up to and including 10000:
count = 79

eban numbers up to and including 100000:
count = 399

eban numbers up to and including 1000000:
count = 399

eban numbers up to and including 10000000:
count = 1599

eban numbers up to and including 100000000:
count = 7999

Run time: 1.848286400010693 seconds.
</pre>


=={{header|Go}}==
=={{header|Go}}==