HP Forums

Full Version: Programming Challenge: Find a Particular Prime Number
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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.

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).

acht Billiarden acht Billionen achthundertdreiundzwanzig

EDIT: Oops, no:

acht Billiarden acht Billionen achthundertdreiundvierzig
(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)
(10-29-2016 02:26 PM)Maximilian Hohmann Wrote: [ -> ]acht Billiarden acht Billionen achthundertachtzigtausendhundertneunzehn


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
acht Billiarden acht Billionen achthundertachtzigtausendachthundertdreiundsechzig
(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!

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
acht Billiarden acht Billionen achthundertachttausendachthundertdreiunddreißig
If you allow "Billiarde" & "Billion" I guess you have also to allow "Milliarde" & "Million"?
(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!
This is what I come up with when trying to enumerate numbers in German alphabetical order:

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. :-)
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
(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.

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. :-)
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


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.
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.
Touché, Thomas Okken, without b-numbers & m-numbers 808853 wins.

& with b-numbers & m-numbers?

(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.

(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.
Pages: 1 2
Reference URL's