Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
62
Task/Sexy-primes/EasyLang/sexy-primes.easy
Normal file
62
Task/Sexy-primes/EasyLang/sexy-primes.easy
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
len isdiv[] 1000035
|
||||
proc sieve . .
|
||||
max = sqrt len isdiv[]
|
||||
for d = 2 to max
|
||||
if isdiv[d] = 0
|
||||
for i = d * d step d to len isdiv[]
|
||||
isdiv[i] = 1
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
sieve
|
||||
#
|
||||
proc showsx nr . .
|
||||
for i = len isdiv[] - 6 * nr downto 3
|
||||
if isdiv[i] = 0
|
||||
h = 0
|
||||
for j to nr
|
||||
h += isdiv[i + j * 6]
|
||||
.
|
||||
if h = 0
|
||||
cnt += 1
|
||||
if cnt <= 5
|
||||
s[] &= i
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
print cnt & " sexy primes of " & nr + 1
|
||||
if cnt > 5
|
||||
write "... "
|
||||
.
|
||||
for i = lower 5 len s[] downto 1
|
||||
write "(" & s[i]
|
||||
for j to nr
|
||||
write " " & s[i] + j * 6
|
||||
.
|
||||
write ") "
|
||||
.
|
||||
print ""
|
||||
.
|
||||
proc showunsx . .
|
||||
for i = len isdiv[] - 6 downto 2
|
||||
if isdiv[i] = 0 and isdiv[i + 6] = 1 and (i <= 6 or isdiv[i - 6] = 1)
|
||||
cnt += 1
|
||||
if cnt <= 10
|
||||
s[] &= i
|
||||
.
|
||||
.
|
||||
.
|
||||
print cnt & " unsexy primes"
|
||||
write "... "
|
||||
for i = 10 downto 1
|
||||
write s[i] & " "
|
||||
.
|
||||
print ""
|
||||
.
|
||||
showsx 1
|
||||
showsx 2
|
||||
showsx 3
|
||||
showsx 4
|
||||
showunsx
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import "/fmt" for Fmt
|
||||
import "/math" for Int
|
||||
import "./fmt" for Fmt
|
||||
import "./math" for Int
|
||||
|
||||
var printHelper = Fn.new { |cat, le, lim, max|
|
||||
var cle = Fmt.commatize(le)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue