Post Reply 
Programming Challenge: Find a Particular Prime Number
10-29-2016, 11:31 AM
Post: #1
Programming Challenge: Find a Particular Prime Number
Using any HP calculator, find the alphabetically first prime number as written in Standard German orthography.(Not English as there are too many variations in USA, UK, etc)

Programme & solutions please.
Find all posts by this user
Quote this message in a reply
10-29-2016, 11:58 AM (This post was last modified: 10-29-2016 01:16 PM by Maximilian Hohmann.)
Post: #2
RE: Programming Challenge: Find a Particular Prime Number
Hello!

Maybe I don't understand the challenge, but my solution would be something like:

*deleted* ... I finally understood what it is about. I think know the solution without writing a program (which would not fit into my favorite progammable calculator, the Hp25, anyway).

Regards
Max
Find all posts by this user
Quote this message in a reply
10-29-2016, 02:10 PM (This post was last modified: 10-29-2016 02:15 PM by Thomas Okken.)
Post: #3
RE: Programming Challenge: Find a Particular Prime Number
acht Billiarden acht Billionen achthundertdreiundzwanzig

EDIT: Oops, no:

acht Billiarden acht Billionen achthundertdreiundvierzig
Visit this user's website Find all posts by this user
Quote this message in a reply
10-29-2016, 02:26 PM (This post was last modified: 10-29-2016 02:28 PM by Maximilian Hohmann.)
Post: #4
RE: Programming Challenge: Find a Particular Prime Number
(10-29-2016 02:10 PM)Thomas Okken Wrote:  acht Billiarden acht Billionen achthundertdreiundvierzig

acht Billiarden acht Billionen achthundertachtzigtausendhundertneunzehn

(I used this generator for the primes: https://www.browserling.com/tools/prime-numbers and this converter to get the german words: http://bmanolov.free.fr/num2textconv.php)
Find all posts by this user
Quote this message in a reply
10-29-2016, 02:52 PM (This post was last modified: 10-29-2016 02:56 PM by Thomas Okken.)
Post: #5
RE: Programming Challenge: Find a Particular Prime Number
(10-29-2016 02:26 PM)Maximilian Hohmann Wrote:  acht Billiarden acht Billionen achthundertachtzigtausendhundertneunzehn

Nice!!

I arrived at the "acht Billiarden acht Billionen achthundertdreiund-" part by reasoning, but I goofed in missing the fact that you can tack on another "acht" after the "hundert" (i.e. that the "achthundert" could be 800000 instead of 800).

I used this to check primality: https://www.alpertron.com.ar/ECM.HTM
Visit this user's website Find all posts by this user
Quote this message in a reply
10-29-2016, 03:05 PM
Post: #6
RE: Programming Challenge: Find a Particular Prime Number
acht Billiarden acht Billionen achthundertachtzigtausendachthundertdreiundsechzig
Visit this user's website Find all posts by this user
Quote this message in a reply
10-29-2016, 05:20 PM (This post was last modified: 10-29-2016 05:20 PM by Maximilian Hohmann.)
Post: #7
RE: Programming Challenge: Find a Particular Prime Number
(10-29-2016 03:05 PM)Thomas Okken Wrote:  acht Billiarden acht Billionen achthundertachtzigtausendachthundertdreiundsechzig

Cool! Like you, it figured out quickly that "acht Billiarden" must be the starting point.

Next, I came to the conclusion that I only have very few calculators in my collection which might me capable of testing if such large integers are primes, converting the numbers to strings and storing and sorting those strings. And all in a survivable timespan... The Hp50, Ti89/200, HP71B and a couple of other BASIC programmables maybe.

Looking forward to see some actual programs running on a calculator!

Max
Find all posts by this user
Quote this message in a reply
10-29-2016, 06:39 PM
Post: #8
RE: Programming Challenge: Find a Particular Prime Number
Yes, the search space is too large for pure brute-force, and once you start thinking about how to reduce it, before you know it you've solved the puzzle by reasoning alone -- although we both demonstrated how easily you can get that wrong. :-)

I thought this might be a puzzle that others had figured out and written about before this, but all I found was this: http://www.matheboard.de/archive/547281/thread.html
Visit this user's website Find all posts by this user
Quote this message in a reply
10-30-2016, 05:15 PM
Post: #9
RE: Programming Challenge: Find a Particular Prime Number
acht Billiarden acht Billionen achthundertachttausendachthundertdreiunddreißig
Visit this user's website Find all posts by this user
Quote this message in a reply
10-30-2016, 10:00 PM
Post: #10
RE: Programming Challenge: Find a Particular Prime Number
If you allow "Billiarde" & "Billion" I guess you have also to allow "Milliarde" & "Million"?
Find all posts by this user
Quote this message in a reply
10-30-2016, 10:33 PM
Post: #11
RE: Programming Challenge: Find a Particular Prime Number
(10-30-2016 10:00 PM)Gerald H Wrote:  If you allow "Billiarde" & "Billion" I guess you have also to allow "Milliarde" & "Million"?

Sure. But that doesn't help in this specific puzzle!
Find all posts by this user
Quote this message in a reply
10-31-2016, 01:53 AM (This post was last modified: 10-31-2016 01:56 AM by Thomas Okken.)
Post: #12
RE: Programming Challenge: Find a Particular Prime Number
This is what I come up with when trying to enumerate numbers in German alphabetical order:

acht
acht Billiarden
acht Billiarden acht
acht Billiarden acht Billionen
acht Billiarden acht Billionen acht
acht Billiarden acht Billionen achthundert
acht Billiarden acht Billionen achthundertacht
acht Billiarden acht Billionen achthundertachttausend
acht Billiarden acht Billionen achthundertachttausendacht
acht Billiarden acht Billionen achthundertachttausendachthundert
acht Billiarden acht Billionen achthundertachttausendachthundertacht
acht Billiarden acht Billionen achthundertachttausendachthundertachtundachtzig
acht Billiarden acht Billionen achthundertachttausendachthundertachtunddreißig
acht Billiarden acht Billionen achthundertachttausendachthundertachtundfünfzig
acht Billiarden acht Billionen achthundertachttausendachthundertachtundneunzig
acht Billiarden acht Billionen achthundertachttausendachthundertachtundsechzig
acht Billiarden acht Billionen achthundertachttausendachthundertachtundsiebzig
acht Billiarden acht Billionen achthundertachttausendachthundertachtundvierzig
acht Billiarden acht Billionen achthundertachttausendachthundertachtundzwanzig
acht Billiarden acht Billionen achthundertachttausendachthundertachtzehn
acht Billiarden acht Billionen achthundertachttausendachthundertachtzig
acht Billiarden acht Billionen achthundertachttausendachthundertdrei <- first odd number
acht Billiarden acht Billionen achthundertachttausendachthundertdreißig
acht Billiarden acht Billionen achthundertachttausendachthundertdreiundachtzig
acht Billiarden acht Billionen achthundertachttausendachthundertdreiunddreißig <- first prime number

It looks like the real challenge of this puzzle is enumerating numbers in alphabetical order. I bet it's not too much harder to do this in English. :-)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-31-2016, 03:26 AM (This post was last modified: 10-31-2016 03:41 AM by Thomas Okken.)
Post: #13
RE: Programming Challenge: Find a Particular Prime Number
eight
eight billion
eight billion eight
eight billion eighteen
eight billion eighteen hundred
eight billion eighteen hundred eight
eight billion eighteen hundred eighteen
eight billion eighteen hundred eighty
eight billion eighteen hundred eighty-eight
eight billion eighteen hundred eighty-five <- first odd number
eight billion eighteen hundred eighty-four
eight billion eighteen hundred eighty-nine
eight billion eighteen hundred eighty-one <- first prime
Visit this user's website Find all posts by this user
Quote this message in a reply
10-31-2016, 03:49 AM
Post: #14
RE: Programming Challenge: Find a Particular Prime Number
(10-31-2016 01:53 AM)Thomas Okken Wrote:  I bet it's not too much harder to do this in English. :-)

The problems will arise due to different flavours of English having different rules for numbers. e.g. eight billion and nine is prime, although some folks wouldn't agree either on primality or the English used. I doubt it is the first.

Is a billion 1,000,000,000,000 or merely 1,000,000,000 ?
Is it three hundred two vs three hundred and two.

Pauli
Find all posts by this user
Quote this message in a reply
10-31-2016, 11:37 AM
Post: #15
RE: Programming Challenge: Find a Particular Prime Number
I didn't realize that "billion" still means 10^12 in (any parts of) the English-speaking world! Do those dialects also still use "milliard" etc.?

Allowing the word "and" doesn't change things, though: "eight billion and eighteen hundred eighty-one." Unless there are rules about where exactly "and" is or isn't allowed in a number, and as a non-native speaker, I have nothing to contribute to that discussion. :-)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-31-2016, 04:02 PM
Post: #16
RE: Programming Challenge: Find a Particular Prime Number
English was excluded in Post #1 due to variations between the lesser billion & the greater billion (although one billion two hundred & seventy-one is prime both ways) & deviant usage of "and" in US & UK.

Normatively in UK "and" is inserted between hundreds & smaller numbers.

Expressions such as "eighteen hundred" are not regularly used inside larger numbers & , except for year numbers, are more for colloquial style. In counting objects the form is rarely used.

German usage is in general better standardized.

My own preference is to avoid using the b-numbers due to

1 Ambiguity amongst English speakers

2 Ignorance among all speakers.

In a survey in Vienna the majority could not read 1,345,000,222,000 as a number containing the word "Billion".

Avoiding b-numbers, I was originally happy to consider

883

the solution to the challenge.

As Duden recognizes b-numbers I acknowledge Thomas Okken's suggestion as preceding 883 alphabetically & a more worthy candidate to win the challenge.

I trust seekers are trying to find an alphabetically prior solution.
Find all posts by this user
Quote this message in a reply
11-01-2016, 05:17 AM
Post: #17
RE: Programming Challenge: Find a Particular Prime Number
If you want to exclude Billiarde and Billion (or if you want to exclude all solutions that consist of multiple words) then the answer is 808853.

I'm not surprised that people in Vienna don't read a 13-digit number as something containing the word "Billion." I read German-language news every day, and the word Billion shows up very rarely. Millionen and Milliarden, yes, but Billionen, not so much.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-01-2016, 06:38 AM (This post was last modified: 11-01-2016 06:50 AM by Gerald H.)
Post: #18
RE: Programming Challenge: Find a Particular Prime Number
Touché, Thomas Okken, without b-numbers & m-numbers 808853 wins.

& with b-numbers & m-numbers?
Find all posts by this user
Quote this message in a reply
11-01-2016, 11:44 AM
Post: #19
RE: Programming Challenge: Find a Particular Prime Number
Hello!

(11-01-2016 05:17 AM)Thomas Okken Wrote:  I read German-language news every day, and the word Billion shows up very rarely.

If you read the finacial part of the newspaper the billion comes up quite frequently, mostly in conjunction with the U.S. state deficit...

Regarding a solution for the Billiarde/Billion case that can be implemented on a pocket calculator, I still dont't have the faintest idea how that could possibly work.

Regards
Max
Find all posts by this user
Quote this message in a reply
11-01-2016, 01:19 PM
Post: #20
RE: Programming Challenge: Find a Particular Prime Number
(11-01-2016 06:38 AM)Gerald H Wrote:  & with b-numbers & m-numbers?

In that case, my earlier submission still stands: 8,008,000,000,808,833. That was composed assuming no restrictions on allowable words.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)