Project:
programmingpraxis
programmingpraxis
-
Scheme,
pasted
on Oct 7:
|
; the first n primes
(define-syntax pq-rank (syntax-rules () ((_ pq) (vector-ref pq 0))))
(define-syntax pq-item (syntax-rules () ((_ pq) (vector-ref pq 1))))
(define-syntax pq-lkid (syntax-rules () ((_ pq) (vector-ref pq 2))))
(define-syntax pq-rkid (syntax-rules () ((_ pq) (vector-ref pq 3))))
(define pq-empty (vector 0 'pq-empty 'pq-empty 'pq-empty))
(define (pq-empty? pq) (eqv? pq pq-empty))
(define (pq-merge lt? p1 p2)
(define (pq-swap item lkid rkid)
(if (< (pq-rank rkid) (pq-rank lkid))
(vector (+ (pq-rank rkid) 1) item lkid rkid)
(vector (+ (pq-rank lkid) 1) item rkid lkid)))
(cond ((pq-empty? p1) p2)
((pq-empty? p2) p1)
((lt? (pq-item p2) (pq-item p1))
(pq-swap (pq-item p2) (pq-lkid p2)
(pq-merge lt? p1 (pq-rkid p2))))
(else (pq-swap (pq-item p1) (pq-lkid p1)
(pq-merge lt? (pq-rkid p1) p2)))))
(define (pq-insert lt? x pq)
(pq-merge lt? (vector 1 x pq-empty pq-empty) pq))
(define (pq-first pq)
(if (pq-empty? pq)
(error 'pq-first "empty priority queue")
(pq-item pq)))
(define (pq-rest lt? pq)
(if (pq-empty? pq)
(error 'pq-rest "empty priority queue")
(pq-merge lt? (pq-lkid pq) (pq-rkid pq))))
(define (lt? a b)
(or (< (car a) (car b))
(and (= (car a) (car b))
(< (cdr a) (cdr b)))))
(define (n-primes n)
(let ((pq (pq-insert lt? (cons 9 6) pq-empty)))
(let loop1 ((i 5) (pq pq) (ps (list 3 2)) (k 2))
; (display "loop1 ") (display i) (display " ") (display (pq->list lt? pq))
; (display " ") (display ps) (display " ") (display k) (newline)
(cond ((= n k) (reverse ps))
((< i (car (pq-first pq)))
(let* ((c (* i i)) (s (+ i i))
(pq (pq-insert lt? (cons c s) pq)))
(loop1 (+ i 2) pq (cons i ps) (+ k 1))))
(else (let loop2 ((pq pq))
; (display "loop2 ") (display (pq->list lt? pq)) (newline)
(if (< i (car (pq-first pq)))
(loop1 (+ i 2) pq ps k)
(let* ((c (car (pq-first pq)))
(s (cdr (pq-first pq)))
(pq (pq-rest lt? pq)))
(loop2 (pq-insert lt? (cons (+ c s) s) pq))))))))))
(display (n-primes 168))
|
Output:
|
(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997)
|
|
Create a new paste based on this one
Comments:
posted by
CHANEYLEONOR32
on Jan 7
Custom essays writing services should advice the content related with this good topic and I opine that could be no efforts to buy term paper or if you would like to buy an essay about this thing!
reply
posted by
SheliaHardy
on Jan 10
Study system is influenced by educational law. However, students still are required to compose essays. I think that students should not be embarrassed! The essay papers service will offer supreme quality of writing! I solve my academic papers writing troubles in such way also.
reply
posted by
Melinda34Floyd
on Jan 10
You would buy a research paper and buy essays about this post, using the support the paper writing service.
reply
posted by
OneilAdeline
on Jan 20
Wonderful emotions fill up myself when I work on academic essay assignments. I don't understand students who buy a Custom Written Essay. It is such a pleasance to accomplish research papers by yourself.
reply
posted by
StevensonBeatriz20
on Jan 20
There are men who can shift your academic writing stress. I have used their services and orders were free from plagiarism. Once there was prorogue of the research for 1 day and I grumbled to their support. They gave me discount of 50% for next term paper and there were no problems afterwards. So, try it yourself, buy Management essay and be fulfilled with high results.
reply
posted by
JodyBooth
on Feb 3
I have often received good written custom research papers from that company and that essay writing is the only one I will use. I truly choose that I can discus with the writer and upload my directions so simply. There are many essays companies but this are acceptable in my mind, thank you!
reply
posted by
EstesLea
on Feb 5
I do know that we would like to get know about this good topic or essay writing. At the essay writing services it is really easy to purchase research paper and custom essay just about this post.
reply
posted by
Jones27LIZ
on Mar 31
Utilizing our cheap seo services, businessmen should realize that search engine optimization is more workable than mass media kinds of advertisement. Furthermore, we commonly offer very good low-priced options for our constant customers!
reply
posted by
CLAREMarquez
on Apr 23
That's good that we can receive the credit loans moreover, that opens up new possibilities.
reply
posted by
Carly19EATON
on Apr 30
I don't want to be dismissed from the high school. I I would better like to buy Essays Online. all my dudes do it.
reply
posted by
GretchenMOSES21
on May 16
If you want to buy a house, you would have to receive the business loans. Moreover, my mother usually uses a short term loan, which seems to be really reliable.
reply
posted by
Gillespie35Lois
on May 28
Some people find some facts about this topic from different sources. But I will suggest to buy custom essay papers choosing the custom writing service. Thus, men always order custom papers.
reply
posted by
SantanaSTELLA27
on Jun 1
How could you compose your master’s idea referring to this post we wonder? The buy thesis exclusivethesis.com service could employ people as you to do the thesis papers creating. So you could have a really good opportunity to enter to the group of professionals.
reply
posted by
Brittney28Garrett
on Jun 1
High school programs include essay competing. Therefore, a lot of high school students become to pay for essay "primeessays.com" from websites.
reply
posted by
AdrianaStout21
on Jun 4
Your great writing just about this good post comes parallel with the dissertation cover. Thence, you must even work for thesis (master-dissertations.com) service.
reply
posted by
KNAPPLESLIE
on Jun 4
Different scholars are willing to find the thesis research about this good post. When they get know about your superior theme, they would plausibly order the thesis writing (topthesis.com).
reply
posted by
JuneFIELDS
on Jun 12
This will be not very easy to complete hot thesis project connecting with this topic by your own! My own advice is to find the trustworthy custom dissertation services or you can to buy your dissertation at thesis writing service.
reply
posted by
TrishaDay22
on Jun 15
That is hard to buy thesis theme connecting with this good post! First of all students should determine professional thesis writing service or buy dissertation service, after that this would be real to buy thesis project in internet.
reply
posted by
MCINTYRENona35
on Jun 18
You have to be really imaginative guy to do such superior dissertation connecting with this good topic . I would buy custom essays or thesis service about this. I appreciate this!
reply
posted by
Mcfarland30Simone
on Jun 22
Do you understand that articles you submit to article directories need to be unique, because it reflects on you website's ranking! Look for masters articles submit company. Article directory submission issues presented by our professionals are of high standards. Hence, you can surely get great ranking.
reply
posted by
MARISuarez
on Jun 25
There’re a lot of different ways to get know about this post. You would simply click Freelance writing job 4writers.net service to find all , which is needed!
reply
posted by
BrownWendy25
on Jul 15
There’re some advices about the way to get the academic success. Thus, you just need know the story and just accomplish the professional United States essay paper. The another way is to find the experienced essay papers writing service and just buy essay in Internet. We hope it will help.
reply
posted by
Moss20Alejandra
on Jul 16
I was advised to make use of research paper shop that have been working in the business at least for 5 years.
reply
posted by
CHRISTYJimenez28
on Jul 16
Have no cash to buy a building? Worry not, because it is real to take the personal loans goodfinance-blog.com to work out such problems. So get a consolidation loan to buy all you want.
reply
posted by
CleoHendricks22
on Jul 18
I heard from college students, they could not manage with biographies essay (essaysbank.com). Nonetheless, is it a problem to employ some great writing organization to purchase research papers from.
reply
posted by
FrancesKRAMER21
on Jul 19
Students who have problems with producing papers know that it's great to papers to buy written by proficient writers. Check this link if you want to get expert assistance with writing papers online you should come to these essay writing company.
reply
posted by
ROMEROLauren27
on Jul 21
Get in touch with this Web site "essayswriters.com" if you decide to purachase term paper of the best quality. I guarantee that you will receive essays and paper writing.
reply
posted by
Brenda32Castro
on Jul 23
My online business is getting well and PR of my online site is better. All this is just because I select the masters to work with. I utilize high quality site submission tools at forum proifle service of high reputation. Thanks those experts very much!
reply
posted by
ValerieMOSES27
on Jul 26
Take into consideration such fact that while getting essay papers to buy at custom writing services, you can get uneven attitude. In case you begin to understand that the agency wants to cheat you, do not buy college term paper from it.
reply
posted by
Fowler24Rosalyn
on Jul 29
Some scholars don't worry about their grades and they can accomplish not professional management thesis. However, I can tell that any thesis help service can perform supreme doctoral dissertation, which will suit every one's needs.
reply
posted by
GeraldineGallagher26
on Jul 30
Go to home page so that you could get good written essays and take your editing burden off your shoulders as we are the best organization that awards you with professional academic writing help.
reply
posted by
HALE18Chris
on Aug 21
If you are in not good state and have got no cash to move out from that point, you will need to receive the mortgage loans goodfinance-blog.com. Just because that will help you definitely. I get collateral loan every time I need and feel good because of that.
reply
posted by
Clay22Laura
on Aug 26
Are your grades important for you? Thus, do not buy cheap customized term papers! Opt for the essay papers "premiumqualityessays.com" service that can guarantee that papers are written of supreme quality. You have to be sure that you bring your teacher the best academic papers!
reply
posted by
FIELDSIsabella33
on Aug 29
Are you a sophomore fed up with your writing assignments? Then look over here "superbessay.com" and don’t lose the chance to order ideal English research paper and find best writing service.
reply
posted by
Farley29Annmarie
on Aug 30
Custom research paper assist me counsel all my custom term paper from beginning to end. I didn't have to decay a single second searching the colleges' own petitions for the masked custom papers queries, and I never had to disquiet if I was overlooking some custom term paper for one of the special programs I was applying to. What would have taken hours took shorter than few minutes with writing services "prime-writing.com".
reply
posted by
MONROESummer25
on Sep 2
Click here and purchase excellent academic essays from the expert organisation. It is proved that every customer will have good paper writing help.
reply
posted by
LinaLevine22
on Sep 5
If you do not acknowledge what custom research paper (bestwritingservice.com)service to choose for your essay topic creating, you will have to be analyze all the online sources very tightly.
reply
posted by
SHORTElinor
on Sep 5
Click up here if you need to buy essay online. This custom writing centre has been in the market for a long time, so it will provide you with essay custom writing help without any problems.
reply
posted by
FuentesMargret
on Sep 8
When you use the essays online qualityessay.com service, you do not waste your money. Furthermore, you simplify your life, purchasing customized term papers.
reply
posted by
ArmstrongElise31
on Sep 8
Some time before I guessed that academic writing used to be not complicated. Nonetheless, I tried accomplish my own research paper and I realized that my writing skills were poor. Thence, I decided to find the Research Paper Subjects (exclusivepapers.com) offering organizations!
reply
posted by
MargaretMckee
on Sep 24
I do definitely require good site just because it can give my internet business a completely new power. Some expert seo package (topqualitybacklinks.com) service aided a lot of my comrades.
reply
posted by
AlyceCampbell27
on Oct 1
Whether we cherish it or not, formerly in our lives, we would want to carry out term papers and other written adventure. It is easily not apparent but very alluring to produce a investigate about this good post. To do that, you need to read many of articles and books, or you can just order some kind of work and then use plagiarism checking (plagiarismsearch.com) performed by
http://www.plagiarismsearch.com and save your time like some quick help with the American Dream.
reply
posted by
HOPPER27Amparo
on Oct 4
You don’t need to think over how to write a resume at all. Expert resume writers are at a hand’s reach. Check out Prime-Resume company with the aim to glance over resume formats or buy resume. Be confident that you will obtain excellent and professional resume writing service.
reply
posted by
ShepherdEva18
on Oct 4
Different guys cannot stop using somebody's thought for their stuff. Nonetheless, you can avoid the plagiarized stuff with a purpose to save you good name. So, utilize check plagiarism.
reply
posted by
DELEON28Leah
on Oct 4
Our time seems to be drudging. Hence, how can high school students find free time for academic assignments completing? They definitely need certified assistance! In fact, they have an opportunity to order essay writing paper "marvelousessays.com" services.
reply
posted by
Booker33Lidia
on Oct 4
If you are willing to buy real estate, you will have to receive the personal loans "goodfinance-blog.com". Furthermore, my brother always utilizes a college loan, which supposes to be the most useful.
reply
posted by
SALAZAR23HOPE
on Oct 7
Learn necessary information on the Web page and choose essays online in order get a term paper or buy scientific research papers from that agency.As only skilled writers cooperate with this company you will receive increadible assistance with custom writing UK.All you have to to it to gain help with research paper at this paper writing company.
reply
posted by
NEWTONSHARRON26
on Oct 7
Some students get know that to have a good result they have to buy the pre written essays from the essay writing service supremeessays.com. Another way, they should ask you to write a hot topic.
reply
posted by
MARGARETWATERS
on Oct 10
Now we have a good opportunity to take the support of the thesis service that could finish nice thesis examples connecting with this good post. But I propose to look for the experienced dissertation writing service to buy a thesis in.
reply
posted by
JaniceSummers28
on Oct 10
Buy writing research papers because the professional staff of this paper store is well known for proposing excellently done write-ups to the undegraduates all around the globe. Opt for Essayslab "essayslab.com" company and you will be fascinated by the level of term paper help.
reply
posted by
EttaBoyle
on Oct 13
The whole internet is filled with thesis or thesis research close to this good topic but to get truly perfect buy dissertation service, some students could try some of them.
reply
posted by
ShaunaHeath
on Oct 13
Fed up with constant cramming? Don’t hang back and check out Web page to buy term paper and obtain flawless college essay writing service.
reply
posted by
MackBETTE20
on Oct 16
Do you have issues with producing papers? The only way for you is to visit this website (primeessays.com) if you want to purchase custom college essays from great paper writing firm. You will get good custom essay service. If you have issues with essay writing surf the Primeessays company to get a term paper.
reply
posted by
WadeLacey30
on Oct 16
Check out Web page "gogetessays.com" in order to buy an essay paper and you will obtain reliable essay writing service.
reply
posted by
GRIFFITH28Briana
on Oct 27
Are you searching how to write a resume or where to receive resume writing samples and professional resume writers review? Or you merely wish to order resume from certified resume writers? Just contact Resume firm.
reply
posted by
MayClayton21
on Oct 27
With the help of TopWritingService.com rewiew you receive essential info about many organizations that render essay writing help on the Web.
reply
posted by
MULLENMarianne34
on Nov 3
Don’t have the faintest idea which organization to pick to receive assistance from? Look over GoGetEssays testimonials, and make a right decision.
reply
posted by
BRIGITTE29AYERS
on Nov 3
Thank you, it's very admirable story about this good topic it might be very helpful for students. Recently i needed resume service. To my adroitest surprise, resume was worthy the price I paid for it.
reply
posted by
Lorrie21Chapman
on Nov 21
Page rank of my blog seems to be low now. Thus, I guess that I require professional seo backlink "4submission.com" service. Probably, that will aid to solve my PR complications. Could somebody suggest some submission services please?
reply
posted by
McdonaldKerry
on Nov 30
I don’t know how to conduct the extensive analysis of the appropriate topic, and will better buy college paper writing written from the top by real professionals.
reply
posted by
BLEVINSQueen32
on Feb 1
To receive good miscellaneous essay paper seems to be not just a dream at present time. Papers writing services furnish high school students with high quality free essays. So, that's great possibility for you to get a success.
reply
posted by
Moreno25Marian
on Feb 9
Thare’s no other way to have good grade than to accomplish the college essays but that’s, as well, good to opt for the wars essay (manyessays.com) at the the best essay writing service.
reply
posted by
LUPEForbes
on Feb 16
Following my own analysis, billions of people in the world get the loans (goodfinance-blog.com) at different creditors. Thus, there is a good chance to get a financial loan in any country.
reply
posted by
GraceFerguson
on Feb 16
I propose not to wait until you earn enough money to buy goods! You can just get the loans (goodfinance-blog.com) or secured loan and feel yourself comfortable
reply
posted by
ANNIEBrady33
on Feb 16
This company gives perfect essay editing. Go to home page (gogetessays.com) to buy custom essays.
reply
posted by
Tammy34Humphrey
on Mar 9
Any man in the our world would like to stay original, but does not get know the best way to do it. But millions of different people serch for the freelance writer wanted, so I hope this link will be helpful.
reply
posted by
Baird20Araceli
on Mar 16
Are you looking which service to choose for buying resume or where to obtain samples of resume writing and professional CV writing services? Or you just wish to buy CV from professional resume writers? Only contact Resume company exclusiveresume.com.
reply
posted by
Amanda30POTTS
on Mar 19
Are you hunting how to write a resume or where to receive samples of resume writing and professional resume writing? Or you simply want to buy CV from best resume writers? Only contact Resume firm.
reply
posted by
Gomez29Leila
on Mar 19
Are you willing to get resume service, that conform the range of study you expect?. You can count on our resume writers, as you count on yourself. Thanks because it is the useful information
reply
posted by
sanaa
on Jul 30
I don’t know how to conduct the extensive analysis of the appropriate topic, and will better buy college paper writing written from the top by real professionals.
http://www.asiafm99.com
reply
posted by
Hipolitfmer23
on Feb 13
Aliens On Moonshine by Sin City Seeds is a potent CBD-rich phenotype of The Cali Connections Sour Alien crossed with White Moonshine. This hybrid has some great balanced effects to both lift your mood and provide some strong body relaxation.
https://lizavetacbd.com
reply
posted by
ramkumar34
on Apr 5
www-10-0-0-1.com
is a default IP Address that is used by the Netgear and D-Link model routers. This router gateway is a private IPv4 network. There is only one device that can be used on this IP address.
reply
posted by
ramkumar34
on Apr 5
http://www-10-0-0-1.com
is a default IP Address that is used by the Netgear and D-Link model routers. This router gateway is a private IPv4 network. There is only one device that can be used on this IP address.
reply