Programming Challenge: Find a Particular Prime Number
10-29-2016, 11:31 AM
Post: #1
 Gerald H Senior Member Posts: 1,430 Joined: May 2014
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.
10-29-2016, 11:58 AM (This post was last modified: 10-29-2016 01:16 PM by Maximilian Hohmann.)
Post: #2
 Maximilian Hohmann Senior Member Posts: 674 Joined: Dec 2013
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
10-29-2016, 02:10 PM (This post was last modified: 10-29-2016 02:15 PM by Thomas Okken.)
Post: #3
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
RE: Programming Challenge: Find a Particular Prime Number
acht Billiarden acht Billionen achthundertdreiundzwanzig

EDIT: Oops, no:

acht Billiarden acht Billionen achthundertdreiundvierzig
10-29-2016, 02:26 PM (This post was last modified: 10-29-2016 02:28 PM by Maximilian Hohmann.)
Post: #4
 Maximilian Hohmann Senior Member Posts: 674 Joined: Dec 2013
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)
10-29-2016, 02:52 PM (This post was last modified: 10-29-2016 02:56 PM by Thomas Okken.)
Post: #5
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
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
10-29-2016, 03:05 PM
Post: #6
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
RE: Programming Challenge: Find a Particular Prime Number
acht Billiarden acht Billionen achthundertachtzigtausendachthundertdreiundsechzig
10-29-2016, 05:20 PM (This post was last modified: 10-29-2016 05:20 PM by Maximilian Hohmann.)
Post: #7
 Maximilian Hohmann Senior Member Posts: 674 Joined: Dec 2013
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
10-29-2016, 06:39 PM
Post: #8
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
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
10-30-2016, 05:15 PM
Post: #9
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
RE: Programming Challenge: Find a Particular Prime Number
acht Billiarden acht Billionen achthundertachttausendachthundertdreiunddreißig
10-30-2016, 10:00 PM
Post: #10
 Gerald H Senior Member Posts: 1,430 Joined: May 2014
RE: Programming Challenge: Find a Particular Prime Number
If you allow "Billiarde" & "Billion" I guess you have also to allow "Milliarde" & "Million"?
10-30-2016, 10:33 PM
Post: #11
 Maximilian Hohmann Senior Member Posts: 674 Joined: Dec 2013
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!
10-31-2016, 01:53 AM (This post was last modified: 10-31-2016 01:56 AM by Thomas Okken.)
Post: #12
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
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. :-)
10-31-2016, 03:26 AM (This post was last modified: 10-31-2016 03:41 AM by Thomas Okken.)
Post: #13
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
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
10-31-2016, 03:49 AM
Post: #14
 Paul Dale Senior Member Posts: 1,576 Joined: Dec 2013
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
10-31-2016, 11:37 AM
Post: #15
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
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. :-)
10-31-2016, 04:02 PM
Post: #16
 Gerald H Senior Member Posts: 1,430 Joined: May 2014
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.
11-01-2016, 05:17 AM
Post: #17
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
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.
11-01-2016, 06:38 AM (This post was last modified: 11-01-2016 06:50 AM by Gerald H.)
Post: #18
 Gerald H Senior Member Posts: 1,430 Joined: May 2014
RE: Programming Challenge: Find a Particular Prime Number
Touché, Thomas Okken, without b-numbers & m-numbers 808853 wins.

& with b-numbers & m-numbers?
11-01-2016, 11:44 AM
Post: #19
 Maximilian Hohmann Senior Member Posts: 674 Joined: Dec 2013
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
11-01-2016, 01:19 PM
Post: #20
 Thomas Okken Senior Member Posts: 939 Joined: Feb 2014
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.
 « Next Oldest | Next Newest »

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