This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A037274 #104 Feb 16 2025 08:32:37 %S A037274 1,2,3,211,5,23,7,3331113965338635107,311,773,11,223,13,13367,1129, %T A037274 31636373,17,233,19,3318308475676071413,37,211,23,331319,773,3251, %U A037274 13367,227,29,547,31,241271,311,31397,1129,71129,37,373,313,3314192745739,41,379,43,22815088913,3411949,223,47,6161791591356884791277 %N A037274 Home primes: for n >= 2, a(n) = the prime that is finally reached when you start with n, concatenate its prime factors (A037276) and repeat until a prime is reached (a(n) = -1 if no prime is ever reached). %C A037274 The initial 1 could have been omitted. %C A037274 Probabilistic arguments give exactly zero for the chance that the sequence of integers starting at n contains no prime, the expected number of primes being given by a divergent sequence. - _J. H. Conway_ %C A037274 After over 100 iterations, a(49) is still composite - see A056938 for the latest information. %C A037274 More terms: %C A037274 a(50) to a(60) are 3517, 317, 2213, 53, 2333, 773, 37463, 1129, 229, 59, 35149; %C A037274 a(61) to a(65) are 61, 31237, 337, 1272505013723, 1381321118321175157763339900357651; %C A037274 a(66) to a(76) are 2311, 67, 3739, 33191, 257, 71, 1119179, 73, 379, 571, 333271. %C A037274 This is different from A195264. Here 8 = 2^3 -> 222 -> ... -> 3331113965338635107 (a prime), whereas in A195264 8 = 2^3 -> 23 (a prime). - _N. J. A. Sloane_, Oct 12 2014 %D A037274 Jeffrey Heleen, Family Numbers: Mathemagical Black Holes, Recreational and Educational Computing, 5:5, pp. 6, 1990. %D A037274 Jeffrey Heleen, Family numbers: Constructing Primes by Prime Factor Splicing, J. Recreational Math., Vol. 28 #2, 1996-97, pp. 116-119. %H A037274 Christian N. K. Anderson, <a href="/A037274/a037274_1.txt">Table of known values of n, # of steps to reach a(n), and a(n)</a> or NA if a(n) has 30 digits or more. Also, the trajectory, with factors separated by a |, terminated by either "(end)" or "-> ?" if a(n) has 30 digits or more. %H A037274 Patrick De Geest, <a href="http://www.worldofnumbers.com/topic1.htm">Home Primes < 100 and Beyond</a> %H A037274 M. Herman and J. Schiffman, <a href="http://www.jstor.org/stable/10.5951/mathteacher.107.8.0606">Investigating home primes and their families</a>, Math. Teacher, 107 (No. 8, 2014), 606-614. %H A037274 N. J. A. Sloane, <a href="/A195264/a195264.pdf">Confessions of a Sequence Addict (AofA2017)</a>, slides of invited talk given at AofA 2017, Jun 19 2017, Princeton. Mentions this sequence. %H A037274 N. J. A. Sloane, Three (No, 8) Lovely Problems from the OEIS, Experimental Mathematics Seminar, Rutgers University, Oct 05 2017, <a href="https://vimeo.com/237029685">Part I</a>, <a href="https://vimeo.com/237030304">Part 2</a>, <a href="https://oeis.org/A290447/a290447_slides.pdf">Slides.</a> (Mentions this sequence) %H A037274 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/HomePrime.html">Home Prime.</a> %H A037274 Wikipedia, <a href="http://en.wikipedia.org/wiki/Home_prime">Home prime</a> %e A037274 9 = 3*3 -> 33 = 3*11 -> 311, prime, so a(9) = 311. %e A037274 The trajectory of 8 is more interesting: %e A037274 8 -> %e A037274 2 * 2 * 2 -> %e A037274 2 * 3 * 37 -> %e A037274 3 * 19 * 41 -> %e A037274 3 * 3 * 3 * 7 * 13 * 13 -> %e A037274 3 * 11123771 -> %e A037274 7 * 149 * 317 * 941 -> %e A037274 229 * 31219729 -> %e A037274 11 * 2084656339 -> %e A037274 3 * 347 * 911 * 118189 -> %e A037274 11 * 613 * 496501723 -> %e A037274 97 * 130517 * 917327 -> %e A037274 53 * 1832651281459 -> %e A037274 3 * 3 * 3 * 11 * 139 * 653 * 3863 * 5107 %e A037274 and 3331113965338635107 is prime, so a(8) = 3331113965338635107. %p A037274 b:= n-> parse(cat(sort(map(i-> i[1]$i[2], ifactors(n)[2]))[])): %p A037274 a:= n-> `if`(isprime(n) or n=1, n, a(b(n))): %p A037274 seq(a(n), n=1..48); # _Alois P. Heinz_, Jan 09 2021 %t A037274 f[n_] := FromDigits@ Flatten[ IntegerDigits@ Table[ #[[1]], { #[[2]] }] & /@ FactorInteger@n, 2]; g[n_] := NestWhile[ f@# &, n, !PrimeQ@# &]; g[1] = 1; Array[g, 41] (* _Robert G. Wilson v_, Sep 22 2007 *) %o A037274 (PARI) step(n)=my(f=factor(n),s="");for(i=1,#f~,for(j=1,f[i,2],s=Str(s,f[i,1]))); eval(s) %o A037274 a(n)=if(n<4,return(n)); while(!isprime(n), n=step(n)); n \\ _Charles R Greathouse IV_, May 14 2015 %o A037274 (SageMath) %o A037274 def digitLen(x,n): %o A037274 r=0 %o A037274 while(x>0): %o A037274 x//=n %o A037274 r+=1 %o A037274 return r %o A037274 def concatPf(x,n): %o A037274 r=0 %o A037274 f=list(factor(x)) %o A037274 for c in range(len(f)): %o A037274 for d in range(f[c][1]): %o A037274 r*=(n**digitLen(f[c][0],n)) %o A037274 r+=f[c][0] %o A037274 return r %o A037274 def hp(x,n): %o A037274 x1=concatPf(x,n) %o A037274 while(x1!=x): %o A037274 x=x1 %o A037274 x1=concatPf(x1,n) %o A037274 return x %o A037274 #example: prints the home prime of 8 in base 10 %o A037274 print(hp(8,10)) %o A037274 (Python) %o A037274 from sympy import factorint, isprime %o A037274 def f(n): return int("".join(str(p)*e for p, e in factorint(n).items())) %o A037274 def a(n): %o A037274 if n == 1: return 1 %o A037274 fn = n %o A037274 while not isprime(fn): fn = f(fn) %o A037274 return fn %o A037274 print([a(n) for n in range(1, 40)]) # _Michael S. Branicky_, Jul 11 2022 %Y A037274 Cf. A006919, A037271, A037272, A037273, A037275, A037276, A037919-A037941, A048986, A056938. %Y A037274 Cf. A195264 (use exponents instead of repeating primes). %Y A037274 Cf. A084318 (use only one copy of each prime), A248713 (Fermi-Dirac analog: use unique representation of n>1 as a product of distinct terms of A050376). %Y A037274 Cf. also A120716 and related sequences. %K A037274 nonn,nice,base %O A037274 1,2 %A A037274 _N. J. A. Sloane_, _Jeff Burch_ %E A037274 Corrected and extended by _Karl W. Heuer_, Sep 30 2003