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

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

A340633 Primes of the form k + A037276(k).

Original entry on oeis.org

2, 29, 41, 233, 239, 251, 257, 269, 293, 311, 359, 383, 401, 419, 449, 467, 491, 2269, 2309, 2339, 2377, 2381, 2393, 2411, 2417, 2447, 2473, 2503, 2543, 2579, 2591, 2621, 2633, 2671, 2687, 2699, 2713, 2753, 2789, 2797, 2819, 2843, 2879, 2939, 3011, 3041, 3067, 3083, 3119, 3137, 3167, 3191, 3203
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jan 13 2021

Keywords

Comments

All terms have first digit 2, 3 or 4.

Examples

			a(1) =   2 =  1 + A037276(1)  =  1 +   1;
a(2) =  29 =  6 + A037276(6)  =  6 +  23;
a(3) =  41 = 14 + A037276(14) = 14 +  27;
a(4) = 233 = 22 + A037276(22) = 22 + 211;
a(5) = 251 = 18 + A037276(18) = 18 + 233
           = 34 + A037276(34) = 34 + 217.
		

Crossrefs

Programs

  • Maple
    N:= 5000: # for terms <= N
    dcat:= proc(L) local i, x;
      x:= L[-1];
      for i from nops(L)-1 to 1 by -1 do
        x:= 10^(1+ilog10(x))*L[i]+x
      od;
      x
    end proc:
    A037276:= proc(n) local F;
      F:= sort(ifactors(n)[2], (a, b) -> a[1] < b[1]);
      dcat(map(t -> t[1]$t[2], F));
    end proc:
    A037276(1):= 1:
    R:= NULL:
    for n from 1 to N/2 do
      v:= n + A037276(n);
      if v < N and isprime(v) then R:= R, v fi;
    od:
    sort(convert({R},list));

A340634 Numbers k such that k + A037276(k) is prime.

Original entry on oeis.org

1, 6, 14, 18, 22, 26, 34, 36, 38, 46, 48, 62, 66, 74, 106, 108, 110, 122, 134, 146, 156, 166, 170, 174, 178, 194, 196, 198, 206, 226, 230, 254, 262, 274, 278, 290, 294, 298, 306, 318, 354, 362, 374, 386, 392, 394, 416, 420, 422, 426, 458, 466, 468, 490, 502, 504, 516, 526, 528, 530, 532, 544, 562
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jan 14 2021

Keywords

Comments

All terms except 1 are even.

Examples

			a(3) = 14 is a term because 14 + A037276(14) = 14 + 27 = 41 is prime.
		

Crossrefs

Programs

  • Maple
    dcat:= proc(L) local i, x;
      x:= L[-1];
      for i from nops(L)-1 to 1 by -1 do
        x:= 10^(1+ilog10(x))*L[i]+x
      od;
      x
    end proc:
    A037276:= proc(n) local F;
      F:= sort(ifactors(n)[2], (a, b) -> a[1] < b[1]);
      dcat(map(t -> t[1]$t[2], F));
    end proc:
    A037276(1):= 1:
    select(t -> isprime(t + A037276(t)), [1,seq(i,i=3..1000)]);

A340636 Primes of the form k + A037276(k) in more than one way.

Original entry on oeis.org

251, 2671, 2687, 2753, 23327, 23561, 27827, 28499, 28789, 28817, 29411, 34757, 223441, 226001, 227537, 230849, 231359, 232217, 232259, 232367, 232643, 232919, 233591, 234791, 236129, 236609, 236867, 237857, 238141, 239023, 239873, 240899, 241169, 241343, 241687, 241691, 242447, 242747, 245299
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jan 14 2021

Keywords

Examples

			a(3) = 2687 = 170 + A037276(170) = 170 + 2517
            = 458 + A037276(458) = 458 + 2229.
The first term that occurs in more than two ways is
a(163) = 2255299 =  4180 + A037276(4180)  =  4180 + 2251119
                 = 21156 + A037276(21156) = 21156 + 2234143
                 = 29560 + A037276(29560) = 29560 + 2225739.
		

Crossrefs

Programs

  • Maple
    N:= 5*10^5: # for terms <= N
    dcat:= proc(L) local i, x;
      x:= L[-1];
      for i from nops(L)-1 to 1 by -1 do
        x:= 10^(1+ilog10(x))*L[i]+x
      od;
      x
    end proc:
    A037276:= proc(n) local F;
      F:= sort(ifactors(n)[2], (a, b) -> a[1] < b[1]);
      dcat(map(t -> t[1]$t[2], F));
    end proc:
    A037276(1):= 1:
    R:= NULL:
    for n from 1 to N/2 do
      v:= n + A037276(n);
      if v < N and isprime(v) then R:= R, v fi;
    od:
    S:= {R}:
    select(s -> numboccur(s,[R])>1, S);

A287883 Partial sums of A037276.

Original entry on oeis.org

1, 3, 6, 28, 33, 56, 63, 285, 318, 343, 354, 577, 590, 617, 652, 2874, 2891, 3124, 3143, 3368, 3405, 3616, 3639, 5862, 5917, 6130, 6463, 6690, 6719, 6954, 6985, 29207, 29518, 29735, 29792, 32025, 32062, 32281, 32594, 34819, 34860, 35097, 35140, 37351, 37686, 37909, 37956, 60179, 60256, 60511
Offset: 1

Views

Author

N. J. A. Sloane, Jun 20 2017

Keywords

Crossrefs

Cf. A037276.

Programs

  • Mathematica
    co[n_, k_] := Nest[Flatten[IntegerDigits[{#, n}]] &, n, k - 1]; A037276 =
    Table[FromDigits[Flatten[IntegerDigits[co @@@ FactorInteger[n]]]], {n, 50}]; Table[Sum[A037276[[k]], {k, 1, n}], {n, 1, 25}] (* G. C. Greubel, Jun 23 2017 *)
  • Python
    from sympy import factorint
    def a037276(n):
        f=factorint(n)
        l=sorted([i for i in f])
        return 1 if n==1 else int("".join(str(i)*f[i] for i in l))
    l=[0, 1]
    for n in range(2, 101): l.append(l[n - 1] + a037276(n))
    print(l[1:]) # Indranil Ghosh, Jun 23 2017

A289660 a(n) = A037276(n) - n.

Original entry on oeis.org

0, 0, 0, 18, 0, 17, 0, 214, 24, 15, 0, 211, 0, 13, 20, 2206, 0, 215, 0, 205, 16, 189, 0, 2199, 30, 187, 306, 199, 0, 205, 0, 22190, 278, 183, 22, 2197, 0, 181, 274, 2185, 0, 195, 0, 2167, 290, 177, 0, 22175, 28, 205, 266, 2161, 0, 2279, 456, 2171, 262, 171, 0, 2175, 0, 169, 274, 222158, 448, 2245, 0
Offset: 1

Views

Author

N. J. A. Sloane, Jul 24 2017

Keywords

Comments

The fact that a(n)>0 if n is composite shows that (unlike A080670), A037276 has no nontrivial fixed points (nor any cycles).

Crossrefs

Programs

  • Mathematica
    FromDigits@Flatten@IntegerDigits[Table[#1,{#2}]&@@@FactorInteger@#]-#&/@Range@54 (* Vincenzo Librandi, Jul 25 2017 *)
  • Python
    from sympy import factorint
    def A289660(n):
        return 0 if n == 1 else int(''.join(map(lambda x: str(x[0])*x[1],sorted(factorint(n).items())))) - n # Chai Wah Wu, Jul 25 2017

A351975 Numbers k such that A037276(k) == -1 (mod k).

Original entry on oeis.org

1, 6, 14, 18, 48, 124, 134, 284, 3135, 4221, 9594, 16468, 34825, 557096, 711676, 746464, 1333334, 2676977, 6514063, 11280468, 16081252, 35401658, 53879547, 133333334, 198485452, 223856659, 1333333334, 2514095219, 2956260256, 3100811124, 10912946218, 19780160858
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Feb 26 2022

Keywords

Comments

Numbers k such that the concatenation of prime factors of k is 1 less than a multiple of k.
Contains 2*m for m in A093170.
Terms k where k-1 is prime include 6, 14, 18, 48 and 284. Are there others?

Examples

			a(4) = 48 is a term because 48=2*2*2*2*3 and 22223 == -1 (mod 48).
		

Crossrefs

Programs

  • Maple
    tcat:= proc(x,y) x*10^(1+ilog10(y))+y end proc:
    filter:= proc(n) local F,t,i;
    F:= map(t -> t[1]$t[2], sort(ifactors(n)[2],(a,b)->a[1]
    				
  • Python
    from sympy import factorint
    def A037276(n):
        if n == 1: return 1
        return int("".join(str(p)*e for p, e in sorted(factorint(n).items())))
    def afind(limit, startk=1):
        for k in range(startk, limit+1):
            if (A037276(k) + 1)%k == 0:
                print(k, end=", ")
    afind(10**6) # Michael S. Branicky, Feb 27 2022
    # adapted and corrected by Martin Ehrenstein, Mar 06 2022
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A351975_gen(startvalue=1): # generator of terms >= startvalue
        for k in count(max(startvalue,1)):
            c = 0
            for d in sorted(factorint(k,multiple=True)):
                c = (c*10**len(str(d)) + d) % k
            if c == k-1:
                yield k
    A351975_list = list(islice(A351975_gen(),10)) # Chai Wah Wu, Feb 28 2022

Extensions

a(24)-a(25) from Michael S. Branicky, Feb 27 2022
Prepended 1 and more terms from Martin Ehrenstein, Feb 28 2022

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

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

A067599 Decimal encoding of the prime factorization of n: concatenation of prime factors and exponents.

Original entry on oeis.org

21, 31, 22, 51, 2131, 71, 23, 32, 2151, 111, 2231, 131, 2171, 3151, 24, 171, 2132, 191, 2251, 3171, 21111, 231, 2331, 52, 21131, 33, 2271, 291, 213151, 311, 25, 31111, 21171, 5171, 2232, 371, 21191, 31131, 2351, 411, 213171, 431, 22111, 3251, 21231
Offset: 2

Views

Author

Joseph L. Pe, Jan 31 2002

Keywords

Comments

If n has prime factorization p_1^e_1 * ... * p_r^e_r with p_1 < ... < p_r, then its decimal encoding is p_1 e_1...p_r e_r. For example, 15 = 3^1 * 5^1, so has decimal encoding 3151.
Sequence A068633 is a duplicate, up to a conventional initial term a(1)=11.
a(31) = a(177147) = 311. Is there any solution to a(n) = n? - Franklin T. Adams-Watters, Dec 18 2006
The earliest duplicate is a(223) = 2231 = a(12). There is no fixed point below 3*10^6. - M. F. Hasler, Oct 06 2013

Examples

			The prime factorization of 24 = 2^3 * 3^1 has corresponding encoding 2331. So a(24) = 2331.
a(42) = 213171 since 42 = 2^1*3^1*7^1. - _Amarnath Murthy_, Feb 27 2002
		

Crossrefs

Programs

  • Haskell
    import Data.Function (on)
    a067599 n = read $ foldl1 (++) $
       zipWith ((++) `on` show) (a027748_row n) (a124010_row n) :: Integer
    -- Reinhard Zumkeller, Oct 27 2013
  • Maple
    with(ListTools): with(MmaTranslator[Mma]): seq(FromDigits(FlattenOnce(ifactors(n)[2])), n=2..46); # Wolfdieter Lang, Aug 16 2014
    # second Maple program:
    a:= n-> parse(cat(map(i-> i[], sort(ifactors(n)[2]))[])):
    seq(a(n), n=2..60);  # Alois P. Heinz, Mar 16 2018
  • Mathematica
    f[n_] := FromDigits[ Flatten[ IntegerDigits[ FactorInteger[ n]]]]; Table[ f[n], {n, 2, 50} ]
  • PARI
    A067599(n)=eval(concat(concat([""],concat(Vec(factor(n)~))~))) \\ - M. F. Hasler, Oct 06 2013
    

Extensions

Edited by Robert G. Wilson v, Feb 02 2002
Merged contributions from A068633 to here, and minor edits by M. F. Hasler, Oct 06 2013
Showing 1-10 of 35 results. Next