Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Population-count/PureBasic/population-count.basic
Normal file
15
Task/Population-count/PureBasic/population-count.basic
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
Procedure.i PopCount(n.i) : ProcedureReturn CountString(Bin(Pow(3,n)),"1") : EndProcedure
|
||||
Procedure PutR(v.i) : Print(RSet(Str(v),3)) : EndProcedure
|
||||
|
||||
If OpenConsole()
|
||||
NewList ne() : NewList no()
|
||||
i=0
|
||||
While ListSize(ne())+ListSize(no())<60
|
||||
If CountString(Bin(i),"1")%2=0 : AddElement(ne()) : ne()=i
|
||||
Else : AddElement(no()) : no()=i : EndIf
|
||||
i+1
|
||||
Wend
|
||||
Print("3^i [i=0..29]") : For i=0 To 29 : PutR(PopCount(i)) : Next : PrintN("")
|
||||
Print("Evil numbers ") : ForEach ne() : PutR(ne()) : Next : PrintN("")
|
||||
Print("Odious numb..") : ForEach no() : PutR(no()) : Next : Input()
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue