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 22 results. Next

A037272 Primes reached in A037271, or -1 if no such prime exists.

Original entry on oeis.org

211, 23, 3331113965338635107, 311, 773, 223, 13367, 1129, 31636373, 233, 3318308475676071413, 37, 211, 331319, 773, 3251, 13367, 227, 547, 241271, 311, 31397, 1129, 71129, 373, 313, 3314192745739, 379, 22815088913, 3411949, 223, 6161791591356884791277
Offset: 1

Views

Author

Keywords

Comments

The next term, a(33), is presently unknown. See A037274. - N. J. A. Sloane, Apr 30 2014

Crossrefs

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

A195264 Iterate x -> A080670(x) (replace x with the concatenation of the primes and exponents in its prime factorization) starting at n until reach 1 or a prime (which is then the value of a(n)); or a(n) = -1 if a prime is never reached.

Original entry on oeis.org

1, 2, 3, 211, 5, 23, 7, 23, 2213, 2213, 11, 223, 13, 311, 1129, 233, 17, 17137, 19
Offset: 1

Views

Author

N. J. A. Sloane, Sep 14 2011, based on discussions on the Sequence Fans Mailing List by Alonso del Arte, Franklin T. Adams-Watters, D. S. McNeil, Charles R Greathouse IV, Sean A. Irvine, and others

Keywords

Comments

J. H. Conway offered $1000 for a proof or disproof for his conjecture that every number eventually reaches a 1 or a prime - see OEIS50 link. - N. J. A. Sloane, Oct 15 2014
However, James Davis has discovered that a(13532385396179) = -1. This number D = 13532385396179 = (1407*10^5+1)*96179 = 13*53^2*3853*96179 is clearly fixed by the map x -> A080670(x), and so never reaches 1 or a prime. - Hans Havermann, Jun 05 2017
The number n = 3^6 * 2331961591220850480109739369 * 21313644799483579440006455257 is a near-miss for another nonprime fixed point. Unfortunately here the last two factors only look like primes (they have no prime divisors < 10), but in fact both are composite. - Robert Gerbicz, Jun 07 2017
The number D' = 13^532385396179 maps to D and so is a much larger number with a(D') = -1. Repeating this process (by finding a prime prefix of D') should lead to an infinite sequence of counterexamples to Conway's conjecture. - Hans Havermann, Jun 09 2017
The first 47 digits of D' form a prime P = 68971066936841703995076128866117893410448319579, so if Q denotes the remaining digits of 13^532385396179 then D'' = P^Q is another counterexample. - Robert Gerbicz, Jun 10 2017
This sequence is different from A037274. Here 8 = 2^3 -> 23 (a prime), whereas in A037274 8 = 2^3 -> 222 -> ... -> 3331113965338635107 (a prime). - N. J. A. Sloane, Oct 12 2014
The value of a(20) is presently unknown (see A195265).

Examples

			4 = 2^2 -> 22 =2*11 -> 211, prime, so a(4) = 211.
9 = 3^2 -> 32 = 2^5 -> 25 = 5^2 -> 52 = 2^2*13 -> 2213, prime, so a(9)=2213.
		

Crossrefs

A variant of the home primes, A037271. Cf. A080670, A195265 (trajectory of 20), A195266 (trajectory of 105), A230305, A084318. A230627 (base-2), A290329 (base-3)

Programs

  • Mathematica
    f[1] := 1; f[n_] := Block[{p = Flatten[FactorInteger[n]]}, k = Length[p]; While[k > 0, If[p[[k]] == 1, p = Delete[p, k]]; k--]; FromDigits[Flatten[IntegerDigits[p]]]]; Table[FixedPoint[f, n], {n, 19}] (* Alonso del Arte, based on the program for A080670, Sep 14 2011 *)
    fn[n_] := FromDigits[Flatten[IntegerDigits[DeleteCases[Flatten[
    FactorInteger[n]], 1]]]];
    Table[NestWhile[fn, n, # != 1 && ! PrimeQ[#] &], {n, 19}] (* Robert Price, Mar 15 2020 *)
  • PARI
    a(n)={n>1 && while(!ispseudoprime(n), n=A080670(n));n} \\ M. F. Hasler, Oct 12 2014

A080670 Literal reading of the prime factorization of n.

Original entry on oeis.org

1, 2, 3, 22, 5, 23, 7, 23, 32, 25, 11, 223, 13, 27, 35, 24, 17, 232, 19, 225, 37, 211, 23, 233, 52, 213, 33, 227, 29, 235, 31, 25, 311, 217, 57, 2232, 37, 219, 313, 235, 41, 237, 43, 2211, 325, 223, 47, 243, 72, 252, 317, 2213, 53, 233, 511, 237, 319, 229, 59, 2235
Offset: 1

Views

Author

Jon Perry, Mar 02 2003

Keywords

Comments

Exponents equal to 1 are omitted and therefore this sequence differs from A067599.
Here the first duplicate (ambiguous) term appears already with a(8)=23=a(6), in A067599 this happens only much later. - M. F. Hasler, Oct 18 2014
The number n = 13532385396179 = 13·53^2·3853·96179 = a(n) is (maybe the first?) nontrivial fixed point of this sequence, making it the first known index of a -1 in A195264. - M. F. Hasler, Jun 06 2017

Examples

			8=2^3, which reads 23, hence a(8)=23; 12=2^2*3, which reads 223, hence a(12)=223.
		

Crossrefs

See A195330, A195331 for those n for which a(n) is a contraction.
See also home primes, A037271.
See A195264 for what happens when k -> a(k) is repeatedly applied to n.
Partial sums: A287881, A287882.

Programs

  • Haskell
    import Data.Function (on)
    a080670 1 = 1
    a080670 n = read $ foldl1 (++) $
    zipWith (c `on` show) (a027748_row n) (a124010_row n) :: Integer
    where c ps es = if es == "1" then ps else ps ++ es
    -- Reinhard Zumkeller, Oct 27 2013
    
  • Maple
    ifsSorted := proc(n)
            local fs,L,p ;
            fs := sort(convert(numtheory[factorset](n),list)) ;
            L := [] ;
            for p in fs do
                    L := [op(L),[p,padic[ordp](n,p)]] ;
            end do;
            L ;
    end proc:
    A080670 := proc(n)
            local a,p ;
            if n = 1 then
                    return 1;
            end if;
            a := 0 ;
            for p in ifsSorted(n) do
                    a := digcat2(a,op(1,p)) ;
                    if op(2,p) > 1 then
                            a := digcat2(a,op(2,p)) ;
                    end if;
            end do:
            a ;
    end proc: # R. J. Mathar, Oct 02 2011
    # second Maple program:
    a:= proc(n) option remember; `if`(n=1, 1, (l->
          parse(cat(seq(`if`(l[i, 2]=1, l[i, 1], [l[i, 1],
          l[i, 2]][]), i=1..nops(l)))))(sort(ifactors(n)[2])))
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Mar 17 2020
  • Mathematica
    f[n_] := FromDigits[ Flatten@ IntegerDigits[ Flatten[ FactorInteger@ n /. {1 -> {}}]]]; f[1] = 1; Array[ f, 60] (* Robert G. Wilson v, Mar 02 2003 and modified Jul 22 2014 *)
  • PARI
    A080670(n)=if(n>1, my(f=factor(n),s=""); for(i=1,#f~,s=Str(s,f[i,1],if(f[i,2]>1, f[i,2],""))); eval(s),1) \\ Charles R Greathouse IV, Oct 27 2013; case n=1 added by M. F. Hasler, Oct 18 2014
    
  • PARI
    A080670(n)=if(n>1,eval(concat(apply(f->Str(f[1],if(f[2]>1,f[2],"")),Vec(factor(n)~)))),1) \\ M. F. Hasler, Oct 18 2014
    
  • Python
    import sympy
    [int(''.join([str(y) for x in sorted(sympy.ntheory.factorint(n).items()) for y in x if y != 1])) for n in range(2,100)] # compute a(n) for n > 1
    # Chai Wah Wu, Jul 15 2014

Extensions

Edited and extended by Robert G. Wilson v, Mar 02 2003

A046411 Composite numbers the concatenation of whose prime factors is a prime.

Original entry on oeis.org

6, 12, 18, 21, 22, 28, 33, 39, 46, 51, 52, 54, 58, 63, 66, 70, 82, 84, 93, 98, 111, 115, 117, 133, 141, 142, 148, 154, 159, 162, 165, 166, 171, 172, 175, 177, 182, 187, 198, 201, 205, 207, 210, 219, 220, 226, 232, 235, 237, 245, 246, 247, 249, 253, 255, 261
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Comments

For the corresponding primes, see A038514. - Lekraj Beedassy, Jun 05 2009

Examples

			162 = 2 * 3 * 3 * 3 * 3 and 23333 is a prime, so 162 is in the sequence.
		

Crossrefs

Cf. A038514 (corresponding primes), A221220 (factors without multiplicity).

Programs

  • Mathematica
    co[n_,k_]:=Nest[FromDigits[Flatten[IntegerDigits[{#,n}]]]&,n,k-1]; Select[Range[261],!PrimeQ[#]&&PrimeQ[FromDigits[Flatten[IntegerDigits[co@@@FactorInteger[#]]]]]&](* Jayanta Basu, Jun 04 2013 *)
  • PARI
    is(n)=my(f=factor(n),s="");for(i=1,#f~,for(j=1,f[i,2],s=Str(s,f[i,1]))); isprime(eval(s)) && !isprime(n) \\ Charles R Greathouse IV, May 14 2015
    
  • Python
    from sympy import isprime, factorint
    def ok(n):
        f = factorint(n)
        if sum(e for e in f.values()) < 2: return False
        return isprime(int("".join(str(p)*e for p, e in f.items())))
    print(list(filter(ok, range(2, 262)))) # Michael S. Branicky, Jun 12 2021

Extensions

Edited by Charles R Greathouse IV, Apr 23 2010
Title clarified by Sean A. Irvine, Jan 16 2021

A056938 Concatenate all the prime divisors in previous term (with repetition), starting at 49.

Original entry on oeis.org

49, 77, 711, 3379, 31109, 132393, 344131, 1731653, 71143523, 11115771019, 31135742029, 717261644891, 11193431873899, 116134799345907, 3204751189066719, 31068250396355573, 62161149980213343, 336906794442245927, 734615161567701999, 31318836286194043641
Offset: 1

Views

Author

Robert G. Wilson v, Sep 05 2000

Keywords

Comments

This sequence provides a record of the search for the home prime for 49.
This sequence has now been followed for 117 steps without a prime being reached (after which of course it would simply repeat).

Crossrefs

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, 49, 25]
    (* Second program: *)
    NestList[FromDigits@ Flatten@ Map[IntegerDigits, FactorInteger[#] /. {p_, e_} /; p >= 1 :> If[p == 1, 1, ConstantArray[p, e]]] &, 49, 16] (* Michael De Vlieger, Apr 27 2017 *)
  • PARI
    a=vector(35); a[1]=49; for(k=2,length(a), f=factor(a[k-1]); for(i=1,matsize(f)[1], l=10^ceil(log(f[i,1])/log(10)); for(j=1,f[i,2], a[k]=a[k]*l+f[i,1]))) \\ M. F. Hasler, Mar 09 2007

Extensions

b-file updated by Max Alekseyev, Nov 28 2017

A230305 Iterate A080670 starting at n; a(n) = number of steps to reach a prime, or -1 if no prime is ever reached.

Original entry on oeis.org

0, 0, 2, 0, 1, 0, 1, 4, 3, 0, 1, 0, 3, 4, 2, 0, 3, 0
Offset: 2

Views

Author

N. J. A. Sloane, Oct 27 2013

Keywords

Comments

If n is a prime, a(n) = 0.
a(20) is presently unknown - see A195265 for the trajectory.

Examples

			9 -> 32 -> 25 -> 52 -> 2213, which is prime, taking 4 steps, so a(9) = 4.
		

Crossrefs

Cf. A080670, A195264 (the prime that is reached), A195265, A067599, A037271 (home primes).

Programs

  • Mathematica
    fn[n_] := FromDigits[Flatten[IntegerDigits[DeleteCases[Flatten[FactorInteger[n]], 1]]]];
    Map[Length, Table[NestWhileList[fn, n, # != 1 && ! PrimeQ[#] &], {n, 2,
    19}], {1}] - 1 (* Robert Price, Mar 16 2020 *)

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
Showing 1-10 of 22 results. Next