Prime chains formed by repeatedly doubling a contiguous substring of digits

28 views
Skip to first unread message

Ali Sada

unread,
Sep 29, 2025, 9:31:36 PMSep 29
to seq...@googlegroups.com

Hi everyone,


Hope all is well. In this algorithm, we repeatedly double any contiguous substring of the decimal digits of n and continue only if the result is prime.

Example (starting from 13):
13 → 23 → 43 → 83 → 163 → 263 → 463 → 863 → 1663 → 2663 → 3343 → 3643 → 7243 → …

(In each step, we look first for the smallest valid option.)

I cannot prove this, but I think that this chain does not terminate. Would this be worth submitting as an OEIS sequence?

(And same question for the primes that don't generate such chains, which I suspect might be a fini sequence.)


Best,


Ali


Ali Sada

unread,
Sep 29, 2025, 9:38:21 PMSep 29
to seq...@googlegroups.com
Please ignore the "fini" remark. I just realized that there are countless primes (like 113) that will be multiples of 3 if we double any digit. Sorry. 

Daniel Mondot

unread,
Sep 30, 2025, 12:41:59 AMSep 30
to Ali Sada, seq...@googlegroups.com
For the sequence to work, the starting number has to end with 1, 3, 7, or 9
11, 17, 19, 101, 103, 107, 109 are quick dead-ends.
Unless I misunderstood your process, I don't think that the sequence starting with 13 goes on forever. How do you get from 2663 to 3343 ? Perhaps you meant 3323?
Also I think the next number after 163 is 223, and then it stops at 883

You also need to specify that we are not just double a substring of zero, otherwise the sequence becomes infinite for a bad reason.
I think that the odds that such an infinite sequence exists are uncertain, as the number grows, you get more options to create a new number, but the density of primes is reduced.

Your sequence should be :
13 -> 23 -> 43 -> 83 -> 163 -> 223 -> 443 -> 883 (9 terms)
The next longer sequence I found is :
193 -> 283 -> 563 -> 1063 -> 1123 -> 1223 -> 1423 -> 1823 -> 3623 -> 3643 -> 4243 -> 4283 -> 4363 -> 4423 -> 8423 -> 8443 -> 16843 -> 16883 -> 16963 -> 17863 -> 17923 -> 24923 -> 24943 -> 49843 -> 50683 -> 51283 -> 51563 -> 102563 -> 103123 -> 106123 -> 106243 -> 212243 -> 214243 -> 214283 -> 214363 -> 214663 -> 214723 -> 215443 -> 215483 -> 215563 -> 230563 (41 terms)
The next one is:
5099 -> 5189 -> 10289 -> 10369 -> 10429 -> 20849 -> 21649 -> 42649 -> 42689 -> 45289 -> 45569 -> 91129 -> 91229 -> 91249 -> 92489 -> 92569 -> 185069 -> 190129 -> 190249 -> 280249 -> 560249 -> 560489 -> 560969 -> 621869 -> 622669 -> 622729 -> 644729 -> 688729 -> 776729 -> 776749 -> 846749 -> 852749 -> 905449 -> 910849 -> 911689 -> 923369 -> 926669 -> 933269 -> 933329 -> 933349 -> 933389 -> 936769 -> 973529 (43 terms)

Here is a very long sequence:
1845713 -> 3645713 -> 6645713 -> 6651413 -> 6652813 -> 6652823 -> 6702823 -> 7404823 -> 14404823 -> 14404843 -> 14404883 -> 14404963 -> 14405023 -> 14410043 -> 14420083 -> 14440163 -> 18840163 -> 18840223 -> 19680223 -> 20360423 -> 20720423 -> 20740823 -> 20781643 -> 20782243 -> 20784443 -> 20868443 -> 21668443 -> 21668483 -> 21668963 -> 21677863 -> 21677923 -> 21678823 -> 21687623 -> 21695243 -> 21695483 -> 21695563 -> 21701123 -> 21701243 -> 43402483 -> 43402963 -> 43403863 -> 43406863 -> 43806863 -> 43813663 -> 43827263 -> 47627263 -> 47627323 -> 47634623 -> 47639243 -> 47639483 -> 47639563 -> 48239563 -> 48239623 -> 48279223 -> 48279443 -> 48279883 -> 48289763 -> 48579463 -> 48588923 -> 96588923 -> 96677843 -> 96685643 -> 97365643 -> 97371283 -> 97441283 -> 97482283 -> 97964563 -> 97964623 -> 98024623 -> 106049243 -> 106049443 -> 106089443 -> 106178843 -> 106179683 -> 106188683 -> 106188763 -> 112288763 -> 112288823 -> 112296823 -> 112302823 -> 112305623 -> 112610623 -> 112620623 -> 112620643 -> 125241283 -> 125241563 -> 125242063 -> 125242123 -> 125284123 -> 125284223 -> 150568423 -> 150568823 -> 150576823 -> 150652823 -> 150702823 -> 150705623 -> 150706223 -> 151412423 -> 151424843 -> 151429643 -> 151438643 -> 151876643 -> 152752643 -> 152805283 -> 152805563 -> 152805623 -> 152805643 -> 155605643 -> 155611243 -> 155611483 -> 155621483 -> 156241483 -> 156242483 -> 156242963 -> 156243863 -> 156287723 -> 156288443 -> 156488443 -> 156496843 -> 156896843 -> 157696843 -> 157703683 -> 158403683 -> 158407283 -> 158414563 -> 308414563 -> 308828563 -> 308837063 -> 608837063 -> 609667063 -> 609734123 -> 609738223 -> 610438223 -> 610446223 -> 610452443 -> 610452883 -> 610455763 -> 610456523 -> 610463023 -> 620463023 -> 620526043 -> 620532043 -> 620532083 -> 620532163 -> 1220532163 -> 1441064323 -> 1441068323 -> 1881068323 -> 1881128323 -> 1881156323 -> 1881156643 -> 2881156643 -> 2881157243 -> 2882314243 -> 2882318443 -> 2882326883 -> 2882353763 -> 2882407523 -> 2882415023 -> 2882430043 -> 2882460043 -> 3764920043 -> 3764940043 -> 3764940083 -> 3764940163 -> 3764940323 -> 3764940623 -> 3764941223 -> 3764982223 -> 3764982443 -> 3765062443 -> 3765064883 -> 7530124883 -> 7530124963 -> 7530244963 -> 15060489863 -> 15060489923 -> 15060969923 -> 15060979823 -> 15121879823 -> 15121959623 -> 15122019223 -> 15144019223 -> 15144038443 -> 15148038443 -> 15148068443 -> 15148068883 -> 15148077683 -> 15156077683 -> 15212147683 -> 15212195363 -> 15212290363 -> 15424580363 -> 15424580723 -> 15424660723 -> 15424661443 -> 15424662443 -> 15449322443 -> 15449344843 -> 15449644843 -> 15449645683 -> 15449646283 -> 15450292483 -> 15450294883 -> 15450384883 -> 15450468883 -> 15450528883 -> 15450556883 -> 15450556963 -> 15901113923 -> 15902213923 -> 15902216923 -> 15902233843 -> 15902236843 -> 16804472843 -> 16804544843 -> 16804545643 -> 16805091283 -> 17610182483 -> 17610364963 -> 17610369863 -> 17610379723 -> 17610380423 -> 17610380443 -> 18220760843 -> 18241460843 -> 18241461683 -> 18282861683 -> 18282862363 -> 18283724363 -> 18367424363 -> 18367424723 -> 18367844723 -> 18367844743 -> 18367848743 -> 18367849483 -> 18367849883 -> 18367849963 -> 18367850863 -> 18367901663 -> 18375803323 -> 18381606323 -> 18761606323 -> 18761612323 -> 18761622323 -> 18763244623 -> 18763245223 -> 18763245443 -> 18763290883 -> 18763291763 -> 18763581763 -> 18763662763 -> 18763663463 -> 18763666463 -> 18764266463 -> 18764526463 -> 18764526523 -> 18764533043 -> 18769063043 -> 18778063043 -> 37548063043 -> 37548063083 -> 37596123083 -> 37602243083 -> 37604483083 -> 37604963083 -> 37604966083 -> 37605032083 -> 37605034163 -> 38210064163 -> 38210064223 -> 38220128423 -> 38220256843 -> 38220256883 -> 38240256883 -> 38240257763 -> 38280457763 -> 38280507763 -> 38280508463 -> 38281008463 -> 38281016863 -> 38281032863 -> 38281062863 -> 38281063663 -> 46481063663 -> 46481064323 -> 46562064323 -> 46562064343 -> 46562068643 -> 46562137283 -> 46562174563 -> 46562179123 -> 46562188243 -> 46562276483 -> 46562276963 -> 46562277863 -> 46564277863 -> 93124277863 -> 93124277923 -> 93124355843 -> 93148705843 -> 93148705883 -> 93156705883 -> 93157405883 -> 93157811683 -> 93158621683 -> 93158622283 -> 93158622563 -> 93159242563 -> 93218442563 -> 93436442563 -> 93436484563 -> 93472969123 -> 93473029123 -> 93473058223 -> 93473116423 -> 93473116843 -> 93473233643 -> 93473266643 -> 93473267243 -> 93476267243 -> 93476534483 -> 93476534563 -> 93476539063 -> 93476548063 -> 93483088063 -> 93486176123 -> 93486182123 -> 93486184243 -> 93486188443 -> 93572288443 -> 96572288443 -> 96572288843 -> 96572297683 -> 96644297683 -> 96648587683 -> 96648595283 -> 96648690283 -> 96648780563 -> 193297561123 -> 193305122243 -> 286610244443 -> 286610248843 -> 286610288843 -> 286610289683 -> 286610298683 -> 286610306683 -> 286610307283 -> 286610307563 -> 286610308063 -> 286620308063 -> 286620316123 -> 286620326123 -> 293240652223 -> 293481304223 -> 293481604223 -> 293481608423 -> 293482216843 -> 293482216883 -> 293482233763 -> 293482236763 -> 293482243463 -> 293562243463 -> 293562246863 -> 293562486863 -> 293562972863 -> 293562974863 -> 293562979663 -> 293562989263 -> 293562989323 -> 293562989623 -> 293562990223 -> 293562990443 -> 293562990883 -> 293563080883 -> 383563080883 -> 383563081763 -> 383626081763 -> 383652162763 -> 383652162823 -> 383652165623 -> 383652166223 -> 383652172223 -> 383652344443 -> 383652644443 -> 383652648443 -> 383652696443 -> 383652792443 -> 383652794443 -> 383652798443 -> 383652896843 -> 383652992843 -> 383652994843 -> 383653089643 -> 386653089643 -> 386656089643 -> 386656099243 -> 386656099483 -> 386656108963 -> 386712208963 -> 386714417863 -> 387428817863 -> 387428825723 -> 387428825743 -> 387437651443 -> 387437651483 -> 387437652883 -> 387444652883 -> 387445305683 -> 387445611283 -> 387445622483 -> 387445624483 -> 387445624883 -> 387445649683 -> 387445650283 -> 387451300283 -> 387902600483 -> 387905200483 -> 687905200483 -> 688810400483 -> 688820800483 -> 688820800963 -> 688841600963 -> 777641600963 -> 777683200963 -> 777683201023 -> 777766401023 -> 777772401023 -> 778542401023 -> 779084802043 -> 779084804083 -> 849084804083 -> 849084804163 -> 849084804223 -> 849089608223 -> 849089608243 -> 849089608483 -> 849089608883 -> 849089608963 -> 858179217923 -> 858179417923 -> 858179424923 -> 858179449843 -> 858179450683 -> 858249450683 -> 858249901363 -> 858249901723 -> 858250802723 -> 858301604723 -> 916603208723 -> 916603216723 -> 916603217443 -> 916603217483 -> 916606434883 -> 916606435763 -> 916606470763 -> 916606540763 -> 916606581523 -> 917206581523 -> 917207163023 -> 917414326043 -> 917418652043 -> 917427252043 -> 917427304043 -> 917447304043 -> 917447608043 -> 917448208043 -> 917448416083 -> 917496832163 -> 917497662163 -> 917497664323 -> 917505328643 -> 925010328643 -> 925010628643 -> 925010629243 -> 925020629243 -> 925020629443 -> 925020658843 -> 925021317683 -> 930021317683 -> 930021318283 -> 960042636563 -> 960042673063 -> 960042676063 -> 960042752063 -> 960042754063 -> 960042754123 -> 1920082754123 -> 1920085454123 -> 1920085454143 -> 1920090908243 -> 3840180908243 -> 7680361808243 -> 7680363616243 -> 7680364232483 -> 7680364264483 -> 7680364268963 -> 7680364337923 -> 7680364375823 -> 7680364376623 -> 7680364452623 -> 7680364453243 -> 7680364453283 -> 7680364503283 -> 7680364503563 -> 7680364504123 -> 7680365008123 -> 7680365008243 -> 7680365008483 -> 7680365008963 -> 7680665008963 -> 7680665009863 -> 7680665009923 -> 7680730019843 -> 7680730028843 -> 7680730036843 -> 7680730037683 -> 7680730045283 -> 7680730050563 -> 8280730050563 -> 8280730051123 -> 8280760102243 -> 8280820202243 -> 8280820204483 -> 8280820204963 -> 8280820209863 -> 8361640418863 -> 8361640427663 -> 8361640455323 -> 8361680910623 -> 8361761821243 -> 8361763621243 -> 8361823621243 -> 8361824242483 -> 8362648484483 -> 8362648564483 -> 8362648564883 -> 8362648565683 -> 8363297131363 -> 8363297132363 -> 8363297164363 -> 8363304328663 -> 8363304329323 -> 8363308329323 -> 8363308329643 -> 8363308339283 -> 8363308378483 -> 8423308378483 -> 8423308378883 -> 8423308378963 -> 8423308379023 -> 8423316758023 -> 8423317516043 -> 8423317522043 -> 8426635042043 -> 8426670084083 -> 8427270084083 -> 8427540164083 -> 8427540168083 -> 8428040168083 -> 8428040176163 -> 8428040352323 -> 8428040352343 -> 8428040404643 -> 8456080804643 -> 8456080809283 -> 8456161618283 -> 8456161618363 -> 8456161628363 -> 8456162228363 -> 8456162236723 -> 8456162237443 -> 8456162237843 -> 8456162474843 -> 8456162479643 -> 8456162559283 -> 8456222559283 -> 8456225059283 -> 8456225068283 -> 8456225068483 -> 8462225068483 -> 8462225068883 -> 8462450068883 -> 8462500128883 -> 8462500228883 -> 8462500257683 -> 8462500265363 -> 8465000530663 -> 8465000560663 -> 8465000561323 -> 8465000622643 -> 8465000623283 -> 8465000623483 -> 8465000626883 -> 8465001226883 -> 8465001233683 -> 8930001233683 -> 8930001467363 -> 8930002867363 -> 8930002867663 -> 8960002867663 -> 8960002935263 (602 terms)

So far the longest sequence I found has 613 terms (after a few minutes of calculations)

I think that once there are multiple zeros in a number, it reduces the number of options, and therefore the chances to find a next number that would be prime.
So perhaps finding an infinite sequence is unlikely.

Daniel

--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/seqfan/CACOfRNo%2B03adeQRLkYka9J4eEcWBuJKxDTqputRP%3D0Kjez8TdA%40mail.gmail.com.

Charles caskey Siliwonde

unread,
Sep 30, 2025, 3:05:47 AMSep 30
to seq...@googlegroups.com
Your sequence is so interesting, a proof for it is doable but it needs new tools. 

Charles caskey Siliwonde

unread,
Sep 30, 2025, 8:58:24 AMSep 30
to seq...@googlegroups.com
The sequence is infinite using the same rule here is a simple recursive expression 
a_{n+1} = a_n + 10.2^n which gets to  a_n = 10.2^n +3 for  n = 0,1,2,... after solving the recurrence i introduced earlier on.
Thank you 

Charles caskey Siliwonde

unread,
Sep 30, 2025, 8:58:29 AMSep 30
to seq...@googlegroups.com
you made a mistake from 163 to 263, let 83+80=163, then double 80 we get 160 and add to 163 we get 323 not 263. 


--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.

Daniel Mondot

unread,
Sep 30, 2025, 9:08:09 AMSep 30
to seq...@googlegroups.com
The way I understood the process, we double every substring, check which ones are prime, and keep the smallest one.

So for 163 we obtain:
when doubling the 1: 263 which is prime
when doubling the 6: 223 which is prime
when doubling the 16: 323 which is not prime.
We can't double a substring that includes the final '3' since we would get an even number, which is not prime.
between 263 and 223, the smallest is 223, which we keep for the next step.

Daniel.

Ruud H.G. van Tol

unread,
Sep 30, 2025, 9:21:29 AMSep 30
to seq...@googlegroups.com

On 2025-09-30 06:41, Daniel Mondot wrote:
> [...] How do you get from 2663 to 3343 ? Perhaps you meant 3323?

Looks like a step was skipped: 2663 (-> 3323) -> 3343.

-- Ruud

Ali Sada

unread,
Sep 30, 2025, 10:47:30 AMSep 30
to seq...@googlegroups.com

Thank you for your responses, and I just want to clarify a confusion that I myself fell into.

This algorithm is meant to be the reverse of  A389140 “Smallest final number reachable by successively dividing a substring of digits of n by 2.”

For example, 32 can go to 31 or 16.

If we go the opposite way from 16 we can get 32 (doubling the 16) or 26 (doubling the 1) or 112 (doubling the 6).

13 → 23→ 43→ 83→ 163→ 263→ 863→1663→ 2663→ 4663

 From 4663 we can go to 8663 (double “4” → 8): 4663 → 8663

Or 9323 (double “466” → 932): 4663 → 9323

Or 41263 (double the second “6” → 12): 4663 → 41263.  

We check for the option that gives us a way to continue.

A sequence here could be the records. The smallest number that has 1 step is 23 (à13).

The smallest number that gives us 2 steps is 43 (à23à13). And so on.

 

Best,

 

Ali


--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.

Daniel Mondot

unread,
Sep 30, 2025, 1:05:13 PMSep 30
to seq...@googlegroups.com
ok, so instead of applying the carry to the next digit, you insert it. when doubling the 6, 16 becomes 112 instead of 22.
That would complicate my program a little. and it will make it slower and reach 64 bit numbers a lot faster...

With the rules I have been using, the longest sequence I found starts with 26237599, reaches 10107009789692329 (still below 64 bits), and has 2400 terms.

"We check for the option that gives us a way to continue."  
This is difficult to program, and could take an infinite amount of time. We would need to keep track of every possibility, and the amount of memory needed quickly becomes exponential.
The problem with this approach is that there are most likely multiple paths that give an infinite sequence from the same starting number. But you will never know that for sure.
Then, if you want to keep all the potential branches, you will run out of memory, and if you don't,  how do you decide which one(s) to follow?
You might want to use some heuristic approach, such as, only keep numbers that don't contain a zero, because these will limit your options later. And, then avoid fives, because fives might give you a zero.... Your results will be fluid. you might not get a hard sequence, It might not be repeatable using a different algorithm...

Daniel


Ali Sada

unread,
Sep 30, 2025, 4:31:39 PMSep 30
to seq...@googlegroups.com
Thank you, Daniel. Your approach works too. It's not exactly linked to A38914, but that's not a problem. 2400 terms is really impressive! 
I also agree with you regarding the first approach. Maybe we can look for the smallest option. So, 4663 goes to 8663 then to 81263, and so on. 

Best,

Ali 

Ali Sada

unread,
Oct 3, 2025, 10:45:39 PM (11 days ago) Oct 3
to seq...@googlegroups.com
Hi Daniel and Charles,

Looking at Cf's of A386395, I found that the two versions are perfectly accepted in the OEIS. Both A048385  and A068522 read "In base 10 notation replace digits of n with their squared values." The difference was not explained in the comments, but for n=14, for example,  A048385(14)=116, while  A068522(14)=26. So, maybe we can also use both versions?

On Tue, Sep 30, 2025 at 6:05 PM Daniel Mondot <dmo...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages