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).
1, 2, 3, 211, 5, 23, 7, 3331113965338635107, 311, 773, 11, 223, 13, 13367, 1129, 31636373, 17, 233, 19, 3318308475676071413, 37, 211, 23, 331319, 773, 3251, 13367, 227, 29, 547, 31, 241271, 311, 31397, 1129, 71129, 37, 373, 313, 3314192745739, 41, 379, 43, 22815088913, 3411949, 223, 47, 6161791591356884791277
Offset: 1
Examples
9 = 3*3 -> 33 = 3*11 -> 311, prime, so a(9) = 311. The trajectory of 8 is more interesting: 8 -> 2 * 2 * 2 -> 2 * 3 * 37 -> 3 * 19 * 41 -> 3 * 3 * 3 * 7 * 13 * 13 -> 3 * 11123771 -> 7 * 149 * 317 * 941 -> 229 * 31219729 -> 11 * 2084656339 -> 3 * 347 * 911 * 118189 -> 11 * 613 * 496501723 -> 97 * 130517 * 917327 -> 53 * 1832651281459 -> 3 * 3 * 3 * 11 * 139 * 653 * 3863 * 5107 and 3331113965338635107 is prime, so a(8) = 3331113965338635107.
References
- Jeffrey Heleen, Family Numbers: Mathemagical Black Holes, Recreational and Educational Computing, 5:5, pp. 6, 1990.
- Jeffrey Heleen, Family numbers: Constructing Primes by Prime Factor Splicing, J. Recreational Math., Vol. 28 #2, 1996-97, pp. 116-119.
Links
- Christian N. K. Anderson, Table of known values of n, # of steps to reach a(n), and a(n) 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.
- Patrick De Geest, Home Primes < 100 and Beyond
- M. Herman and J. Schiffman, Investigating home primes and their families, Math. Teacher, 107 (No. 8, 2014), 606-614.
- N. J. A. Sloane, Confessions of a Sequence Addict (AofA2017), slides of invited talk given at AofA 2017, Jun 19 2017, Princeton. Mentions this sequence.
- N. J. A. Sloane, Three (No, 8) Lovely Problems from the OEIS, Experimental Mathematics Seminar, Rutgers University, Oct 05 2017, Part I, Part 2, Slides. (Mentions this sequence)
- Eric Weisstein's World of Mathematics, Home Prime.
- Wikipedia, Home prime
Crossrefs
Programs
-
Maple
b:= n-> parse(cat(sort(map(i-> i[1]$i[2], ifactors(n)[2]))[])): a:= n-> `if`(isprime(n) or n=1, n, a(b(n))): seq(a(n), n=1..48); # Alois P. Heinz, Jan 09 2021
-
Mathematica
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 *)
-
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) a(n)=if(n<4,return(n)); while(!isprime(n), n=step(n)); n \\ Charles R Greathouse IV, May 14 2015
-
Python
from sympy import factorint, isprime def f(n): return int("".join(str(p)*e for p, e in factorint(n).items())) def a(n): if n == 1: return 1 fn = n while not isprime(fn): fn = f(fn) return fn print([a(n) for n in range(1, 40)]) # Michael S. Branicky, Jul 11 2022
-
SageMath
def digitLen(x,n): r=0 while(x>0): x//=n r+=1 return r def concatPf(x,n): r=0 f=list(factor(x)) for c in range(len(f)): for d in range(f[c][1]): r*=(n**digitLen(f[c][0],n)) r+=f[c][0] return r def hp(x,n): x1=concatPf(x,n) while(x1!=x): x=x1 x1=concatPf(x1,n) return x #example: prints the home prime of 8 in base 10 print(hp(8,10))
Extensions
Corrected and extended by Karl W. Heuer, Sep 30 2003
Comments