cp's OEIS Frontend

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.

Showing 1-10 of 10 results.

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).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The initial 1 could have been omitted.
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
After over 100 iterations, a(49) is still composite - see A056938 for the latest information.
More terms:
a(50) to a(60) are 3517, 317, 2213, 53, 2333, 773, 37463, 1129, 229, 59, 35149;
a(61) to a(65) are 61, 31237, 337, 1272505013723, 1381321118321175157763339900357651;
a(66) to a(76) are 2311, 67, 3739, 33191, 257, 71, 1119179, 73, 379, 571, 333271.
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

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.

Crossrefs

Cf. A195264 (use exponents instead of repeating primes).
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).
Cf. also A120716 and related sequences.

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

A037273 Number of steps to reach a prime under "replace n with concatenation of its prime factors", or -1 if no prime is ever reached.

Original entry on oeis.org

-1, 0, 0, 2, 0, 1, 0, 13, 2, 4, 0, 1, 0, 5, 4, 4, 0, 1, 0, 15, 1, 1, 0, 2, 3, 4, 4, 1, 0, 2, 0, 2, 1, 5, 3, 2, 0, 2, 1, 9, 0, 2, 0, 9, 6, 1, 0, 15
Offset: 1

Views

Author

Keywords

Comments

Starting with 49, no prime has been reached after 79 steps.
a(49) > 118, see A056938 and FactorDB link. - Michael S. Branicky, Nov 19 2020

Examples

			13 is already prime, so a(13) = 0.
Starting with 14 we get 14 = 2*7, 27 = 3*3*3, 333 = 3*3*37, 3337 = 47*71, 4771 = 13*367, 13367 is prime; so a(14) = 5.
		

Crossrefs

Programs

  • Haskell
    a037273 1 = -1
    a037273 n = length $ takeWhile ((== 0) . a010051) $
       iterate (\x -> read $ concatMap show $ a027746_row x :: Integer) n
    -- Reinhard Zumkeller, Jan 08 2013
    
  • Mathematica
    nxt[n_] := FromDigits[Flatten[IntegerDigits/@Table[#[[1]], {#[[2]]}]&/@ FactorInteger[n]]]; Table[Length[NestWhileList[nxt, n, !PrimeQ[#]&]] - 1, {n, 48}] (* Harvey P. Dale, Jan 03 2013 *)
  • PARI
    row_a027746(n, o=[1])=if(n>1, concat(apply(t->vector(t[2], i, t[1]), Vec(factor(n)~))), o) \\ after M. F. Hasler in A027746
    tonum(vec) = my(s=""); for(k=1, #vec, s=concat(s, Str(vec[k]))); eval(s)
    a(n) = if(n==1, return(-1)); my(x=n, i=0); while(1, if(ispseudoprime(x), return(i)); x=tonum(row_a027746(x)); i++) \\ Felix Fröhlich, May 17 2021
    
  • Python
    from sympy import factorint
    def a(n):
        if n < 2: return -1
        klst, f = [n], sorted(factorint(n, multiple=True))
        while len(f) > 1:
            klst.append(int("".join(map(str, f))))
            f = sorted(factorint(klst[-1], multiple=True))
        return len(klst) - 1
    print([a(n) for n in range(1, 49)]) # Michael S. Branicky, Aug 02 2021

Extensions

Edited by Charles R Greathouse IV, Apr 23 2010
a(1) = -1 by Reinhard Zumkeller, Jan 08 2013
Name edited by Felix Fröhlich, May 17 2021

A037271 Number of steps to reach a prime under "replace n with concatenation of its prime factors" when applied to n-th composite number, or -1 if no such number exists.

Original entry on oeis.org

2, 1, 13, 2, 4, 1, 5, 4, 4, 1, 15, 1, 1, 2, 3, 4, 4, 1, 2, 2, 1, 5, 3, 2, 2, 1, 9, 2, 9, 6, 1, 15
Offset: 1

Views

Author

Keywords

Comments

a(33) is presently unknown: starting with 49, no prime has been reached after 110 steps. See A037274 for the latest information.

Examples

			Starting with 14 (the seventh composite number) we get 14=2*7, 27=3*3*3, 333=3*3*37, 3337=47*71, 4771=13*367, 13367 is prime; so a(7)=5.
		

Crossrefs

Programs

  • Haskell
    a037271 = length . takeWhile ((== 0) . a010051'') .
                                 iterate a037276 . a002808
    -- Reinhard Zumkeller, Apr 03 2012
  • Mathematica
    maxComposite = 49; maxIter = 40; concat[n_] := FromDigits[ Flatten[ IntegerDigits /@ Flatten[ Apply[ Table, {#[[1]], {#[[2]]}} & /@ FactorInteger[n], {1}]]]]; composites = Select[ Range[2, maxComposite], ! PrimeQ[#] &]; a[n_] := ( lst = NestWhileList[ concat, composites[[n]], ! PrimeQ[#] &, 1, maxIter]; If[PrimeQ[ Last[lst]], Length[lst] - 1, - 1]); Table[a[n], {n, 1, Length[composites]}] (* Jean-François Alcover, Jul 10 2012 *)

A084319 Orbit of 91 under function described in A084317.

Original entry on oeis.org

91, 713, 2331, 3737, 37101, 383149, 1329473, 10912197, 328312853, 1129846623, 3735159117, 31245053039, 173977184859, 3293176308321, 319269241788861, 371325123869195203, 1278647733810375857, 1665622037676698019, 31742715741254857303, 56627509560552923867
Offset: 0

Views

Author

Labos Elemer, Jun 16 2003

Keywords

Comments

This sequence takes 64 steps to reach a prime (which implies A343156(91)=64). - N. J. A. Sloane, Apr 07 2021

Examples

			a(29) = 19797186041838357425713338412621, the 29th iterate.
		

References

  • Eric Angelini, W. Edwin Clark, Hans Havermann, Frank Stevenson, Allan C. Wechsler, and others, Postings to Math Fun mailing list, April 2021.

Crossrefs

Programs

  • Mathematica
    NestList[FromDigits@ Flatten@ IntegerDigits@ Map[First, FactorInteger@ #] &, 91, 17] (* Michael De Vlieger, Mar 25 2017 *)

Extensions

Example corrected by Rémy Sigrist, Apr 07 2021

A006919 Write down all the prime divisors in previous term.

Original entry on oeis.org

8, 222, 2337, 31941, 33371313, 311123771, 7149317941, 22931219729, 112084656339, 3347911118189, 11613496501723, 97130517917327, 531832651281459, 3331113965338635107, 3331113965338635107
Offset: 1

Views

Author

Keywords

References

  • H. Jaleebi, personal communication.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A056938 (same for a(1)=49), A037271-A037276, A048985, A048986, A049065.

Programs

  • Mathematica
    g[ n_ ] := (x = n; d = {}; While[ FactorInteger[ x ] != {}, f = FactorInteger[ x, FactorComplete -> True ][ [ 1, 1 ] ]; x = x/f; AppendTo[ d, IntegerDigits[ f ] ] ]; FromDigits[ Flatten[ d ] ]); NestList[ g, 8, 15 ]
    NestList[FromDigits[Flatten[IntegerDigits/@(Table[First[#],{Last[#]}]& /@ FactorInteger[#])]]&,8,15] (* Harvey P. Dale, Dec 04 2011 *)
  • PARI
    first(N, a=8)=vector(N,i,if(i>1,a=A037276(a),a)) \\ M. F. Hasler, Oct 07 2022

Formula

a(n+1) = A037276(a(n)), a(1) = 8. - M. F. Hasler, Oct 07 2022

Extensions

More terms from Robert G. Wilson v, Sep 05 2000, who remarks that sequence stabilizes at 13th term with a prime.

A049065 Record primes reached in A048986.

Original entry on oeis.org

2, 3, 31, 179, 12007, 1564237, 17320726789571, 401278664296369, 576312045441408907, 37246812772043701411753149215934377, 3690727229000499480592573891534356177653018575120050845976045596834749951228879
Offset: 1

Views

Author

Michael B Greenwald (mbgreen(AT)central.cis.upenn.edu)

Keywords

Comments

The value 37246812772043701411753149215934377 is the base-2 home prime for 922 and occurs after 66 steps. The value 3690727229000499480592573891534356177653018575120050845976045596834749951228879 is the base-2 home prime for 1345 and occurs after 131 steps. The next term (home prime for 2295) contains at least 124 digits. Computation of further terms involves large factorizations. - Sean A. Irvine, Aug 04 2005 [corrected Jul 17 2021]

Crossrefs

Extensions

a(10)-a(11) from Sean A. Irvine, Aug 04 2005
a(10) corrected by Sean A. Irvine, Jul 17 2021

A238579 Home prime sequence (see A037274) starting at 146.

Original entry on oeis.org

146, 273, 3713, 4779, 333359, 1325643, 3111717139, 29177760383, 69142225413, 3471134339561, 7980350584141, 1324115101168677, 33147123900129853, 1941131324815763997, 37816317113233982621, 291304010934939102849, 333777134924210136703397, 7409854792211363875345439
Offset: 1

Views

Author

J. Lowell, Mar 30 2014

Keywords

Comments

Second sequence of this kind with as yet unknown trajectory (see A037274, A056938). - J. Lowell, Apr 27 2017

Examples

			146 = 2*73 so next term is 273; 273 = 3*7*13 so next term is 3713.
		

Crossrefs

Cf. A037274 (home primes), A056938.

Programs

  • Mathematica
    NestList[FromDigits@ Flatten@ Map[IntegerDigits, FactorInteger[#] /. {p_, e_} /; p >= 1 :> If[p == 1, 1, ConstantArray[p, e]]] &, 146, 17] (* Michael De Vlieger, Apr 27 2017 *)
  • PARI
    lista(nn) = {n = 146; for (i=1 , nn, print1(n, ", "); f = factor(n); s = ""; for (j=1, #f~, for (k=1, f[j, 2], s = concat(s, Str(f[j, 1])););); n = eval(s););} \\ Michel Marcus, Mar 31 2014

Extensions

One more term added by J. Lowell, Mar 30 2014
More terms from Jon E. Schoenfield, Mar 30 2014
One further term from N. J. A. Sloane, Mar 31 2014

A331603 a(1) = 1; for n > 1, if a(n-1) is composite then a(n) is the concatenation of all the prime factors in order of a(n-1), otherwise a(n) is the smallest number not yet appearing in the sequence.

Original entry on oeis.org

1, 2, 3, 4, 22, 211, 5, 6, 23, 7, 8, 222, 2337, 31941, 33371313, 311123771, 7149317941, 22931219729, 112084656339, 3347911118189, 11613496501723, 97130517917327, 531832651281459, 3331113965338635107, 9, 33, 311, 10, 25, 55, 511, 773, 11, 12, 223, 13, 14, 27, 333, 3337, 4771, 13367, 15
Offset: 1

Views

Author

Scott R. Shannon, Jan 21 2020

Keywords

Comments

Assuming that all numbers when replaced with the concatenation of their prime factors will eventually reach a prime (see A037274), this sequence will contain all positive integers. a(158) = 49 which currently has no known 'home prime' in the iterative sequence of prime factor replacements; see A056938.

Examples

			a(5) = 22 as a(4) = 4 which has a factorization 4 = 2*2, so the concatenation of factors is '22'.
a(7) = 5 as a(6) = 211 which is prime, and 5 is the smallest number not yet appearing in the sequence.
a(14) = 31941 as a(13) = 2337 which has a factorization 2337 = 3*19*41, so the concatenation of factors is '31941'.
		

Crossrefs

Programs

A343157 Trajectory of 407 under the map x -> A084317(x).

Original entry on oeis.org

407, 1137, 3379, 31109, 132393, 344131, 1731653, 71143523, 115771019, 7133141039, 18152375353, 723112747673, 1938058565667, 372411163329269, 646991575604859, 3500960117162747, 19920988418382133, 479222853318661919, 3877130279948783893, 71942196909541476259, 7170749184914732550379
Offset: 0

Views

Author

Hans Havermann, Apr 07 2021

Keywords

Comments

It is not known if any a(n) is a prime (see discussion in A343156). - N. J. A. Sloane, Apr 07 2021

References

  • Eric Angelini, W. Edwin Clark, Hans Havermann, Frank Stevenson, Allan C. Wechsler, and others, Postings to Math Fun mailing list, April 2021.

Crossrefs

A063970 a(1) = 2; for n>1, write down all divisors of the previous term in order of magnitude.

Original entry on oeis.org

2, 12, 1234612, 1247915831639077814156283086536173061234612
Offset: 1

Views

Author

Labos Elemer, Sep 05 2001

Keywords

Comments

The next term has 3104 digits. - Harvey P. Dale, May 28 2017

Examples

			Divisors of a(3)={1, 2, 4, 79, 158, 316, 3907, 7814, 15628, 308653, 617306, 1234612}
		

Crossrefs

Programs

  • Mathematica
    NestList[FromDigits[Flatten[IntegerDigits/@Divisors[#]]]&,2,4] (* Harvey P. Dale, May 28 2017 *)
  • Python
    from sympy import divisors
    def aupton(terms):
      alst = [2]
      for n in range(2, terms+1):
        alst.append(int("".join(str(d) for d in divisors(alst[-1]))))
      return alst
    print(aupton(4)) # Michael S. Branicky, Feb 12 2021

Extensions

Next term has more than 3000 decimal digits.
Showing 1-10 of 10 results.