Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Marketing Forth programs : prime counting

238 views
Skip to first unread message

Albert van der Horst

unread,
Nov 14, 2017, 4:39:02 PM11/14/17
to
In order to draw attention to Forth programs it is not very
useful to have a site with only Forth programs.
The common interest of those programs is Forth.
non-Forthers will not visit that site.

I start to approach it from an other side. Luring visitors
with interesting programs without starting with telling which
language they are in.

I've collected a rather huge number of prime counting programs.
(note even including all versions of Anton Ertl's sbpcp.)
https://github.com/albertvanderhorst/primecounting

People probably want to run those programs, and they
can, which sometimes require installing a Forth compiler. (hehe)
Such as
https://github.com/albertvanderhorst/ciforth
(hehe)

I intend to have more of those available as a script.

Particularly note the script

r10par

This can do 10^16 in 111 minutes on a computer
where sbpcp needs 103 minutes for 10^15
I7 4790 Intel

It uses two parallel processes on lina64. If you want
to port it, be my guest. I'll publish it gladly on this
site.

This is a start. There needs a lot more background information
about the algorithm's, more languages, better iso compliance etc.

Groetjes Albert
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

minf...@arcor.de

unread,
Nov 14, 2017, 5:25:47 PM11/14/17
to
You really believe that numbercrunching is where Forth shines ???

Albert van der Horst

unread,
Nov 14, 2017, 6:18:41 PM11/14/17
to
In article <30b85d19-34de-4cee...@googlegroups.com>,
Some Forth's (iforth) do a pretty good job.

My Forth (ciforth) badly needs an optimiser and does
the primes up till 10.000.000.000.000.000 in 111 minutes
on a pretty up to date computer (2.5 years old).

dxf...@gmail.com

unread,
Nov 14, 2017, 7:02:58 PM11/14/17
to
Having something which interests people other
than forth aficionados will give the language
exposure (Oh, so Forth isn't dead and here's
someone doing cool things with it). But don't
expect converts. Internet is about instant
gratification. Make things complicated (install
and run a compiler) and visitors will quickly
lose interest.

Paul Rubin

unread,
Nov 14, 2017, 7:52:37 PM11/14/17
to
alb...@cherry.spenarnc.xs4all.nl (Albert van der Horst) writes:
> My Forth (ciforth) badly needs an optimiser and does
> the primes up till 10.000.000.000.000.000 in 111 minutes

I think that is mostly about the algorithm. The answer is around 3e14
so the obvious approaches will be horrible. Apparently pi(x) (the prime
count) has been computed up to 1e26 or the like. So they must be doing
something pretty fancy.

Is this still the best method?

http://www.ams.org/journals/mcom/1985-44-170/S0025-5718-1985-0777285-5/S0025-5718-1985-0777285-5.pdf

Albert van der Horst

unread,
Nov 14, 2017, 10:15:03 PM11/14/17
to
In article <87d14kj...@nightsong.com>,
That held the record in 1985 (checkable by me now): 4 *10^16
I've a fotocopy somewhere.
Then L'eglise and others improved on that several times.
1995 Ribenboim's "new book of prime number records" gives 10^18
as the then record.
After several improvements this train has been abandoned in favour of
complex integrals of the zeta function involving huge precision floating
point numbers. It was long believed that this could not lead to a
practical calculation.

The 10^25 records are with the "Weil explicit formula". No idea what that is.
I'm pretty sure I will not play in that field.

An overview is at:
http://primes.utm.edu/howmany.html

I expect a factor 5 improvement by parallelization still and minor
algorithmic improvements.

Albert van der Horst

unread,
Nov 14, 2017, 10:16:08 PM11/14/17
to
In article <550f64fc-4dc2-4194...@googlegroups.com>,
There will be a temptation path.
You can download just a binary to run, watch prime numbers flick about
your screen and have a fascinating number come out after hours that
can be checked to be correct.
Then you can have ciforth installed using a debian package installed,
which allows you to run scripts in about the same way as a binary, but
you're much closer to the source.
Then there are some invitations to tweak, and one can start
doing their own script. All doc's are there,
There is also Pascal and Python stuff, inviting comparisons for those
who already know how to program. You bet the Forth programs will be
far superior.

Paul Rubin

unread,
Nov 14, 2017, 11:15:25 PM11/14/17
to
alb...@cherry.spenarnc.xs4all.nl (Albert van der Horst) writes:
> An overview is at:
> http://primes.utm.edu/howmany.html

Thanks, that's a very informative page. What algorithm did you use in
your Forth program?

Lars Brinkhoff

unread,
Nov 15, 2017, 2:47:47 AM11/15/17
to
Albert van der Horst wrote:
> I start to approach it from an other side. Luring visitors
> with interesting programs without starting with telling which
> language they are in.

You could e.g. make a useful application in Forth and submit it for
inclusion in Debian and/or Ubuntu. Since the number of such
applications currently is zero, it would be a significant increase.

Albert van der Horst

unread,
Nov 15, 2017, 7:29:44 AM11/15/17
to
In article <87zi7oi...@nightsong.com>,
At the site you can find r10par.frt in the dynamic programming subsection.
So that is the category.

Keep an eye out for the write up's that are upcoming.
It is loosely based on problem 10 of projecteuler.net. Lucy Hedgehog has
made an official overview, available if you've solved problem 10.
That is about summing primes, but it can be used to "do something" with
"all primes".

Albert van der Horst

unread,
Nov 15, 2017, 7:51:15 AM11/15/17
to
In article <7wd14km...@junk.nocrew.org>,
That is the aim of my last years efforts, exactly. Getting a program
in a state that is acceptable for Debian is no small feat.
I've covered a lot of ground. As far as I can tell my
https://github.com/albertvanderhorst/ciforth/blob/master/release/lina_5.3.0_i386.deb
could be acceptable to debian. That means compliant with thousands of
pages of rules and special tools manuals.
I'm now stuck at the hurdle that it must be uploaded in a cryptographically
safe way to debian mentors. Now it is refused without as much
of a hint why.
If that succeeds, I'm to find a mentor, and at that point the
reviewing process can *start*, yes start.

I've quite a list of Forth programs that could run under Debian once
there is a compiler that is easy to use: msp320 metacompilation,
msp430 calibration, communication with an sbc, primecounting
program's, ciasdis , the list goes on.
The first aim is to make them easily installable on Debian.
Popular programs (especially if one of the mentors gets fond of
e.g. ciasdis ) could then make it into a distribution.

Debian is not linux.
So that point will be comparable to Normandy after three days of fighting.

Paul Rubin

unread,
Nov 15, 2017, 12:36:59 PM11/15/17
to
alb...@cherry.spenarnc.xs4all.nl (Albert van der Horst) writes:
> It is loosely based on problem 10 of projecteuler.net. Lucy Hedgehog has
> made an official overview, available if you've solved problem 10.
> That is about summing primes, but it can be used to "do something" with
> "all primes".

Hmm, I did a straightforward brute force solution to p10 that I don't
see how to apply to "all primes". I'm not a member of the projecteuler
site but will look for your write-ups. Thanks.

Robert L.

unread,
Nov 15, 2017, 6:38:24 PM11/15/17
to
On 11/14/2017, Albert van der Horst wrote:

> In order to draw attention to Forth programs it is not very
> useful to have a site with only Forth programs.

puts "In order to draw attention to Forth programs it is not very
useful to have a site with only Forth programs.".
split( /(\W+)/ ).map(&:capitalize).join

In Order To Draw Attention To Forth Programs It Is Not Very
Useful To Have A Site With Only Forth Programs.


In Forth?

--
As for the goyim, gentile souls are of a completely different and inferior
order. They are totally evil with no redeeming qualities whatsoever.... If a
Jew needs a liver, can you take the liver of an innocent non-Jew passing by to
save him? The Torah would probably permit that.
http://archive.org/details/nolies

Robert L.

unread,
Nov 15, 2017, 6:48:30 PM11/15/17
to
On 11/14/2017, Albert van der Horst wrote:

> People probably want to run those programs, and they
> can

"People probably want to run those programs, and they can".
gsub(/\w+/){|s| Hash[*%w(want dislike can can't)][s] || s}

===>
"People probably dislike to run those programs, and they can't"

In Forth?

--
Jews in America are 100 percent united in demanding "open borders" and
"immigration reform", but at the same time hypocritically support Israel
which now uses DNA tests on potential immigrants in order to keep the Jewish
state racially pure. http://archive.org/details/nolies

dxf...@gmail.com

unread,
Nov 15, 2017, 10:50:11 PM11/15/17
to
How goes your marketing? What is it about
Forth that makes you think its users would
make good recruits?

Lars Brinkhoff

unread,
Nov 16, 2017, 1:59:43 AM11/16/17
to
Albert van der Horst wrote:
> Lars Brinkhoff wrote:
>>You could e.g. make a useful application in Forth and submit it for
>>inclusion in Debian and/or Ubuntu.
> That is the aim of my last years efforts, exactly.

Great!

> I've quite a list of Forth programs that could run under Debian once
> there is a compiler that is easy to use

Can't you use Gforth or pForth?

Albert van der Horst

unread,
Nov 16, 2017, 7:52:52 AM11/16/17
to
In article <7wmv3mk...@junk.nocrew.org>,
The goal is : download and run. Gforth nor Python nor pforth fill
that bill.

That being said, only some of the programs on the `primecounting' will
require ciforth, e.g. the 8 thread parallel version.
Others are general Pascal, Forth or Python or require gforth.

I will explain how to run on gforth and instruct how to install
gforth. Certainly no remarks like "this is standard compliant
so it should run one any Forth" (Forth? Whaaaaat? Surely you mean
Fortran?)

minf...@arcor.de

unread,
Nov 17, 2017, 4:21:04 PM11/17/17
to
With all due and deserved respect, it is one optimizing compiler spitting out
machine code that does the job - not Forth. And the chosen algorithm(s).

How would the iForth solution shine against an equivalent Julia program, to
name another language?

Paul Rubin

unread,
Nov 17, 2017, 4:33:04 PM11/17/17
to
minf...@arcor.de writes:
> How would the iForth solution shine against an equivalent Julia
> program, to name another language?

If I understand the algorithm, it would just be a matter of comparing
two compilers at similar code. I don't think Julia's GPU capabilities
(if it has them now) would be much help. The clever thing is the
algorithm itself.

NN

unread,
Dec 2, 2017, 12:18:05 PM12/2/17
to
Hi all,

I am using 32 bit forth and it took me a while to work out how to get past 32 bits. But I am not happy about switching to doubles. Because then I had to convert everything to a double and then memory became an issue. I was already using a large table which didnt help.

My laptop has 4G ram and a slow processor, and time/speed is what it is.

Has anyone has written a prime counting (in forth ) that can handle larger than the cell size. ( ie for a 64 bit forth - values > 2^64 etc )

NN







Albert van der Horst

unread,
Dec 2, 2017, 1:26:34 PM12/2/17
to
In article <717edbf2-a38e-4635...@googlegroups.com>,
NN <novembe...@gmail.com> wrote:
>Hi all,
>
>I am using 32 bit forth and it took me a while to work out how to get past =
>32 bits. But I am not happy about switching to doubles. Because then I had =
>to convert everything to a double and then memory became an issue. I was al=
>ready using a large table which didnt help.
>
>My laptop has 4G ram and a slow processor, and time/speed is what it is.
>
>Has anyone has written a prime counting (in forth ) that can handle larger =
>than the cell size. ( ie for a 64 bit forth - values > 2^64 etc )

The double precision version of Antons improvement of my
"yet another prime counting program" comes to mind.
Google for sbpcpd.fs

>
>NN
0 new messages