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

Home > Numbers
No-primes sequence (Posted on 2014-04-07) Difficulty: 2 of 5
Find the smallest 4-digit prime, consisting of odd digits only, such that by inserting another odd digit (new one or not) between each pair of its digits a composite 7-digit number is produced.

Bonus task 1: Find the smallest 7-digit prime (odd digits only), creating a 13-digit composite number .

Bonus task 2: List additional pairs (i.e. prime, digit) that display this feature.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 1 of 1

  10   P0=1000
  20   while Ct<40
  30     P0=nxtprm(P0)
  40     S=cutspc(str(P0))
  41     Good=1
  42     for Psn=1 to len(S)
  43        if instr("13579",mid(S,Psn,1))=0 then Good=0
  44     next
  45     if Good then
  50     :for D=1 to 9 step 2
  55       :S2=""
  60       :for Psn=1 to len(S)-1
  70           :S2=S2+mid(S,Psn,1)+cutspc(str(D))
 100       :next
 105       :S2=S2+right(S,1)
 110       :if prmdiv(val(S2))<val(S2) then print P0,D:inc Ct
 120     :next D
 130   wend
 
 finds the first few (including lowest) 4-digit prime and inserted digit:
 
 1117    1
 1117    3
 1117    5
 1117    7
 1117    9
 1151    1
 1151    3
 1151    5
 1151    7
 1153    1
 1153    3
 1153    5
 1153    7
 1153    9
 1193    1
 1193    3
 1193    5
 1319    1
 1373    1
 1511    1
 1511    3
 1511    5
 1511    7
 1511    9
 1531    1
 1531    3
 1531    5
 1531    7
 1531    9
 1553    1
 1553    3
 1571    1
 1571    3
 1579    1
 1579    3
 1597    1
 1597    3
 1597    5
 1597    7
 1597    9
 
By changing line 10 to

10   P0=1000000

we get the larger primes and composites:

 1111151         1
 1111151         3
 1111151         5
 1111151         7
 1111151         9
 1111157         1
 1111157         3
 1111157         5
 1111157         7
 1111157         9
 1111333         1
 1111333         3
 1111333         5
 1111333         7
 1111333         9
 1111339         1
 1111339         3
 1111339         5
 1111339         7
 1111339         9
 1111351         1
 1111351         3
 1111351         5
 1111351         7
 1111351         9
 1111379         1
 1111379         3
 1111379         5
 1111379         7
 1111379         9
 1111393         1
 1111393         3
 1111393         5
 1111393         7
 1111393         9
 1111399         1
 1111399         3
 1111399         5
 1111399         7
 1111399         9


  Posted by Charlie on 2014-04-07 13:46:22
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 (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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