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

Home > Numbers
Change the First Digit, Get Three Primes (Posted on 2023-07-17) Difficulty: 3 of 5
A 5-digit base-N prime number P is such that we will obtain three other prime numbers by changing its first digit.

Determine the minimum value of N.

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 2 of 2 |
clearvars,clc
for N=5:36
  p=nextprime(N^4);
  pb=dec2base(p,N);
  ct=0;
  for fd=1:N-1
    pb(1)=dec2base(fd,N);
    p=base2dec(pb,N);
    if isprime(p)
      ct=ct+1;
    end
  end
  if ct>3
    fprintf('%3d  %3d\n',N,ct)
    for fd=1:N-1
      pb(1)=dec2base(fd,N);
      p=base2dec(pb,N);
      if isprime(p)
        fprintf('%3d %6s %8d\n',N,pb,p)
      end
    end
    disp(' ')
  end
end

Finds that 6 is the minimum value for N. Starting with 10001 (decimal 1297), the extra three are 20001, 30001 and 50001, seen below with their decimal equivalents.

Here's the list of all cases through N = 36, the limit of the ability to express such numbers succinctly using conventional digits and alphabetic digits.

Base 12 even has a set of 5 (original plus 4 variants), and base 24 has the maximum for this limited set, 7 (i.e., 1 + 6).

  6    4
  6  10001     1297
  6  20001     2593
  6  30001     3889
  6  50001     6481
 
 12    5
 12  10007    20743
 12  20007    41479
 12  50007   103687
 12  A0007   207367
 12  B0007   228103
 
 14    4
 14  10011    38431
 14  20011    76847
 14  70011   268927
 14  D0011   499423
 
 15    4
 15  10002    50627
 15  70002   354377
 15  90002   455627
 15  D0002   658127
 
 20    4
 20  10001   160001
 20  70001  1120001
 20  C0001  1920001
 20  F0001  2400001
 
 21    4
 21  10002   194483
 21  50002   972407
 21  H0002  3306179
 21  J0002  3695141
 
 24    7
 24  10001   331777
 24  30001   995329
 24  60001  1990657
 24  80001  2654209
 24  G0001  5308417
 24  K0001  6635521
 24  N0001  7630849
 
 27    4
 27  1000G   531457
 27  3000G  1594339
 27  7000G  3720103
 27  H000G  9034513
 
 28    4
 28  10001   614657
 28  C0001  7375873
 28  F0001  9219841
 28  G0001  9834497
 
 30    6
 30  1000D   810013
 30  2000D  1620013
 30  3000D  2430013
 30  6000D  4860013
 30  K000D 16200013
 30  M000D 17820013
 
 32    5
 32  10007  1048583
 32  90007  9437191
 32  A0007 10485767
 32  C0007 12582919
 32  U0007 31457287
 
 33    6
 33  10008  1185929
 33  50008  5929613
 33  B0008 13045139
 33  D0008 15416981
 33  L0008 24904349
 33  T0008 34391717
 
 36    5
 36  1000B  1679627
 36  2000B  3359243
 36  D000B 21835019
 36  L000B 35271947
 36  N000B 38631179

  Posted by Charlie on 2023-07-17 09:58:15
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
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