All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Prime Birthdays II (Posted on 2011-07-14) Difficulty: 3 of 5
(I) Assuming a lifespan of 80 years, in what years of the 20th and 21st centuries (1900-1999), (2000-2099) would you have to be born to have the maximum number of prime birthdays in a year whose sum of the digits is a prime number?

(II) In what years of the same time spans would you have to be born to have the minimum number of prime birthdays in a year whose sum of the digits is a prime number?

(For example, the sum of the digits of the year 1967 is 23, which is a prime number. People born in 1954 were 13 in 1967, which is also a prime number.)

Note: For the purposes of the problem, assume that that people born on Feb. 29 in a leap year still celebrate their birthdays each following year.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 1 of 1
 10     min=9999
 20     for yr0 = 1900 to 2099
 30        age=2:prCt=0
 40        while age < 80
 50          yr=yr0+age
 60          sod=0:y=cutspc(str(yr))
 70          for i=1 to len(y)
 80            sod=sod+val(mid(y,i,1))
 90          next
100          if prmdiv(sod)=sod and sod>1 then inc prCt
110          age=nxtprm(age)
120        wend
130        if prCt>max then max=prCt:maxYr=yr0
140        if prCt<min then min=prCt:minYr=yr0
150     next  
160     print minYr;min
170     print maxYr;max
180     print
220     for yr0 = 1900 to 2099
230        age=2:prCt=0
240        while age < 80
250          yr=yr0+age
260          sod=0:y=cutspc(str(yr))
270          for i=1 to len(y)
280            sod=sod+val(mid(y,i,1))
290          next
300          if prmdiv(sod)=sod and sod>1 then inc prCt
310          age=nxtprm(age)
320        wend
330        if prCt=max or prCt=min then      
340         :age=2 : print yr0,
350         :while age < 80
360         :  yr=yr0+age
370         :  sod=0:y=cutspc(str(yr))
380         :  for i=1 to len(y)
390         :    sod=sod+val(mid(y,i,1))
400         :  next
410         :  if prmdiv(sod)=sod and sod>1 then print age;yr;sod,:endif
420         :  age=nxtprm(age)
430         :wend
440         :print:print
450     next
finds
 1937  3
 2061  14
 


meaning the minimum number is 3 and the maximum is 14, with these first occurring in 1937 and 2061 respectively.

Then, each of these numbers is shown to have two more occurrences within the time period:

 1937    17  1954  19    53  1990  19    73  2010  3
 1946    3  1949  23     17  1963  19    59  2005  7
 1955    3  1958  23     17  1972  19    59  2014  7
 2061    2  2063  11     11  2072  11    13  2074  13    17  2078  17
         29  2090  11    31  2092  13    37  2098  19    41  2102  5    
         43  2104  7     47  2108  11    59  2120  5     61  2122  7    
         67  2128  13    79  2140  7
 2067    2  2069  17     5  2072  11     7  2074  13     11  2078  17    
         23  2090  11    29  2096  17    31  2098  19    37  2104  7    
         41  2108  11    53  2120  5     59  2126  11    61  2128  13   
         73  2140  7     79  2146  13
 2085    2  2087  17     5  2090  11     7  2092  13     11  2096  17    
         13  2098  19    17  2102  5     19  2104  7     23  2108  11   
         37  2122  7     41  2126  11    43  2128  13    59  2144  11   
         61  2146  13    79  2164  13
 
 

where, in each grouping, the year of birth is followed by subgroups of age, year and sum of digits of the year.


  Posted by Charlie on 2011-07-14 13:16:36
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information