Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,38 @@
|
|||
Module Population_count{
|
||||
Function Count(x as long long) {
|
||||
integer Count
|
||||
long long m=x
|
||||
m|div 0x1_0000_0000&&
|
||||
x|mod 0x1_0000_0000&&
|
||||
While x<>0&
|
||||
x=Binary.And(X, X-1&&)
|
||||
Count++
|
||||
End While
|
||||
x=m
|
||||
While x<>0&
|
||||
x=Binary.And(X, X-1&&)
|
||||
Count++
|
||||
End While
|
||||
=Count
|
||||
}
|
||||
long long i, b=3
|
||||
stack new {
|
||||
for i=0 to 29
|
||||
Data count(b^i)
|
||||
next
|
||||
print "3^x population:", array([])#str$()
|
||||
i=0: b=0
|
||||
while i<30
|
||||
if Count(b) mod 2=0 then data b:i++
|
||||
b++
|
||||
end while
|
||||
print "evil numbers:", array([])#str$()
|
||||
i=0: b=0
|
||||
while i<30
|
||||
if Count(b) mod 2=1 then data b:i++
|
||||
b++
|
||||
end while
|
||||
print "odious numbers:", array([])#str$()
|
||||
}
|
||||
}
|
||||
Population_count
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
Module Population_count{
|
||||
Count=lambda (x as long long)->{
|
||||
integer Count
|
||||
long long m=x
|
||||
m|div 0x1_0000_0000&&
|
||||
x|mod 0x1_0000_0000&&
|
||||
While x<>0&
|
||||
x=Binary.And(X, X-1&&)
|
||||
Count++
|
||||
End While
|
||||
x=m
|
||||
While x<>0&
|
||||
x=Binary.And(X, X-1&&)
|
||||
Count++
|
||||
End While
|
||||
=Count
|
||||
}
|
||||
series3pow=lambda Count, i=0&& -> {
|
||||
=count(3&&^i):i++
|
||||
}
|
||||
seriesEvil=lambda Count, i=0&&-> {
|
||||
while Count(i) mod 2=1{i++}
|
||||
=i:i++
|
||||
}
|
||||
seriesOdious=lambda Count, i=0&&-> {
|
||||
while Count(i) mod 2=0{i++}
|
||||
=i:i++
|
||||
}
|
||||
Dim a(30)<<series3pow()
|
||||
print "3^x population:", a()#str$()
|
||||
Dim a(30)<<seriesEvil()
|
||||
print "evil numbers:", a()#str$()
|
||||
Dim a(30)<<seriesOdious()
|
||||
print "odious numbers:", a()#str$()
|
||||
}
|
||||
Population_count
|
||||
Loading…
Add table
Add a link
Reference in a new issue