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-9 of 9 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

A120712 Numbers k with the property that the concatenation of the nontrivial divisors of k (i.e., excluding 1 and k) is a prime.

Original entry on oeis.org

4, 6, 9, 21, 22, 25, 33, 39, 46, 49, 51, 54, 58, 78, 82, 93, 99, 111, 115, 121, 133, 141, 142, 147, 153, 154, 159, 162, 166, 169, 174, 177, 186, 187, 189, 201, 205, 219, 226, 235, 237, 247, 249, 253, 262, 267, 274, 286, 289, 291, 294, 301, 318
Offset: 1

Views

Author

Eric Angelini, Jul 19 2007

Keywords

Examples

			   k |    divisors    | concatenation
  ---+----------------+--------------
   4 | (1) 2      (4) |        2
   6 | (1) 2, 3   (6) |       23
   9 | (1) 3      (9) |        3
  21 | (1) 3, 7  (21) |       37
  22 | (1) 2, 11 (22) |      211
  25 | (1) 5     (25) |        5
  33 | (1) 3, 11 (33) |      311
  39 | (1) 3, 13 (39) |      313
		

Crossrefs

Programs

  • Maple
    with(numtheory):
    for k from 2 to 1000 do:
    v0:=divisors(k):
    nn:=nops(v0):
    if nn > 2 then
    v1:=[seq(v0[j],j=2..nn-1)]:
    v2:=cat(seq(convert(v1[n],string),n=1..nops(v1))):
    v3:=parse(v2):
    if isprime(v3) = true then lprint(k,v3) fi:
    fi:
    od: # Simon Plouffe
  • Mathematica
    fQ[n_] := PrimeQ@ FromDigits@ Most@ Rest@ Divisors@ n; Select[ Range[2, 320], fQ]
  • Python
    from sympy import divisors, isprime
    def ok(n):
        s = "".join(str(d) for d in divisors(n)[1:-1])
        return s != "" and isprime(int(s))
    print([k for k in range(319) if ok(k)]) # Michael S. Branicky, Oct 01 2024

Extensions

Name edited by Michel Marcus, Mar 09 2023

A130139 Let f denote the map that replaces k with the concatenation of its nontrivial divisors, written in increasing order, each divisor being written in base 10 in the normal way. Then a(n) = prime reached when starting at 2n+1 and iterating f.

Original entry on oeis.org

1, 3, 5, 7, 3, 11, 13, 1129, 17, 19, 37, 23, 5, 313, 29, 31, 311, 1129, 37, 313, 41, 43
Offset: 0

Views

Author

N. J. A. Sloane, Jul 30 2007

Keywords

Comments

If 2n+1 is 1 or a prime, set a(n) = 2n+1. If no prime is ever reached, set a(n) = -1.

Examples

			n = 7: 2n+1 = 15 = 3*5 -> 35 = 5*7 -> 57 = 3*19 -> 319 = 11*29 -> 1129, prime, so a(7) = 1129.
		

Crossrefs

Cf. A037279, A130140, A130141, A130142. A bisection of A120716.

Programs

  • Python
    from sympy import divisors, isprime
    def f(n): return int("".join(str(d) for d in divisors(n)[1:-1]))
    def a(n):
        if n == 0: return 1
        fn, c = 2*n + 1, 0
        while not isprime(fn):
            fn, c = f(fn), c+1
        return fn
    print([a(n) for n in range(22)]) # Michael S. Branicky, Jul 11 2022

Extensions

Name edited by Michel Marcus, Mar 09 2023

A130140 Let f denote the map that replaces k with the concatenation of its nontrivial divisors, written in increasing order, each divisor being written in base 10 with its digits in reverse order. Then a(n) = prime reached when starting at 2n+1 and iterating f.

Original entry on oeis.org

1, 3, 5, 7, 3, 11, 13
Offset: 0

Views

Author

David Applegate, Jul 30 2007

Keywords

Comments

If 2n+1 is 1 or a prime, set a(n) = 2n+1. If no prime is ever reached, set a(n) = -1.

Examples

			n = 7: 2n+1 = 15 = 3*5 -> 35 = 5*7 -> 57 = 3*19 -> 391 = 17*23 -> 7132.
Then 7132 has nontrivial divisors 2, 4, 1783, 3566, so we get 2438716653.
Then 2438716653 has nontrivial divisors 3, 9, 27, 81, 243, 1453, 4359, 6907, 13077, 20721, 39231, 62163, 117693, 186489, 353079, 559467, 1678401, 10035871, 30107613, 90322839, 270968517, 812905551, so we get
397218342354195347096770311270213293361263967119846819703537649551048761178530013167010393822309715869072155509218 = 2*3^4*1217*317539*1211548321*33378971294653*8960783431807*17509226460292689821646170308388500174366980857582533580184934929433.
		

Crossrefs

Extensions

Edited by Michel Marcus, Mar 09 2023

A130141 Let f denote the map that replaces k with the concatenation of its nontrivial divisors, written in decreasing order, each divisor being written in base 10 in the normal way. Then a(n) = prime reached when starting at 2n+1 and iterating f.

Original entry on oeis.org

1, 3, 5, 7, 3, 11, 13, 53, 17, 19, 73, 23, 5, 313, 29, 31, 113
Offset: 0

Views

Author

Carsten Lund (lund(AT)research.att.com), Jul 30 2007, Aug 01 2007

Keywords

Comments

If 2n+1 is 1 or a prime, set a(n) = 2n+1. If no prime is ever reached, set a(n) = -1.
The value of a(17) is currently unknown.
From Klaus Brockhaus, Aug 01 2007: (Start)
"The sequence, starting from the beginning but writing 0 when a number with more than 90 digits is reached, is:
1,3,5,7,3,11,13,53,17,19,73,23,5,313,29,31,113,0,37,197,41,43,0,47,7,173,53,0,193,
59,61,0,0,67,233,71,73,0,391393,79,9313991471335749211973,83,0,293,89,137,313,
0,97,0,101,103,0,107,109,373,113,0,391393,593,11,1993,0,127,433,131,197,0,137,139,
0,0,0,0,149,151,511793,0,157,1141931201,6113,163,0,167,13,0,173,0,593,179,181,
613,12575251553,0,0,191,193,0,197,199,673,..." (End)
From Andrew Carter (acarter09(AT)newarka.edu), Dec 16 2008: (Start)
If "when starting at 2n+1" in the definition were replaced by "when starting at n", all even-indexed terms except for a(2) and a(4) would be -1.
A simple proof is that an even number's smallest nontrivial divisor is 2, and the result of iterating f for any even number except for 2 and 4 would have factors in front, so the resulting number would be of the form 10m+2 where m is an integer greater than 1, and therefore an even number ending in 2 other than two itself, so no prime would ever be reached. (End)

Examples

			n = 13: 2n+1 = 27 has nontrivial divisors 3 and 9, so we get 93, which has proper divisors 3 and 31, so we get 313, prime. So a(13) = 313.
		

Crossrefs

Extensions

Edited by Michel Marcus, Mar 09 2023

A130142 Let f denote the map that replaces k with the concatenation of its nontrivial divisors, written in decreasing order, each divisor being written in base 10 with its digits in reverse order. Then a(n) = first prime reached when starting at 2n+1 and iterating f.

Original entry on oeis.org

1, 3, 5, 7, 3, 11, 13, 53, 17, 19, 73, 23, 5, 9343, 29, 31, 113, -1, 37, 313, 41, 43
Offset: 0

Views

Author

Adam L. Buchsbaum (alb(AT)research.att.com), Jul 30 2007, Aug 01 2007

Keywords

Comments

If 2n+1 is 1 or a prime, set a(n) = 2n+1. If no prime is ever reached, set a(n) = -1.
The value of a(17) is currently unknown.

Examples

			n = 13: 2n+1 = 27 has nontrivial divisors 3 and 9, so we get 93, which has proper divisors 3 and 31, so we get 133.
Then 133 has nontrivial divisors 7 and 19, so we get 917.
Then 917 has nontrivial divisors 7 and 131, so we get 1317.
Then 1317 has nontrivial divisors 3 and 439, so we get 9343, a prime and a(13) = 9343.
From _Sean A. Irvine_, Sep 11 2009: (Start)
Proof chain for a(17). The following gives the argument to f at each step, followed by its factorization.
35 factors as 5 * 7.
75 has factors 3 * 5 * 5.
525153 has factors 3 * 193 * 907.
15057112727099753913 has factors 3 * 4463 * 17215189 * 65325353.
179719996575730910515106159846737337176838928854211713151146478934050745192125561494032705883138679506795913535235676554615981512719833136443 has factors 29 * 29 * 5546454298803948416569 * 8370112457804191610629 * 13338101723922940394396774098231 * 345111672681489292530961043464303237918570147336150469919363833
765...4892 (3249 digits) is divisible by 2, and hence all subsequent steps will be divisible by 2, therefore no prime is ever reached, therefore a(17)=-1. (End)
		

Crossrefs

Extensions

5 more terms (details for a(17) in example). Next term requires factoring a 1478-digit number. - Sean A. Irvine, Sep 11 2009
Edited by Michel Marcus, Mar 09 2023

A191647 Numbers n with property that the concatenation of their anti-divisors is a prime.

Original entry on oeis.org

3, 4, 5, 10, 14, 16, 40, 46, 100, 145, 149, 251, 340, 373, 406, 424, 439, 466, 539, 556, 571, 575, 617, 619, 628, 629, 655, 676, 689, 724, 760, 779, 794, 899, 901, 941, 970, 989, 1019, 1055, 1070, 1076, 1183, 1213, 1226, 1231, 1258, 1270, 1285, 1331, 1340
Offset: 1

Views

Author

Paolo P. Lava, Jun 10 2011

Keywords

Comments

Similar to A120712 which uses the proper divisors of n.

Examples

			The anti-divisors of 40 are 3, 9, 16, 27, and 391627 is prime, hence 40 is in the sequence.
		

Crossrefs

Programs

  • Maple
    P:=proc(i) local a,b,c,d,k,n,s,v; v:=array(1..200000);
    for n from 3 by 1 to i do k:=2; b:=0;
    while k0 and (2*n mod k)=0 then b:=b+1; v[b]:=k; fi;
         else
         if (n mod k)>0 and (((2*n-1) mod k)=0 or ((2*n+1) mod k)=0) then
    b:=b+1; v[b]:=k; fi; fi; k:=k+1; od; a:=v[1];
    for s from 2 to b do a:=a*10^floor(1+evalf(log10(v[s])))+v[s]; od;
    if isprime(a) then print(n); fi;
    od; end: P(10^6);
  • Mathematica
    antiDivisors[n_Integer] := Cases[Range[2, n - 1], _?(Abs[Mod[n, #] - #/2] < 1 &)]; a191647[n_Integer] := Select[Range[n],
    PrimeQ[FromDigits[Flatten[IntegerDigits /@ antiDivisors[#]]]] &]; a191647[1350] (* Michael De Vlieger, Aug 09 2014, "antiDivisors" after Harvey P. Dale at A066272 *)
  • Python
    from sympy import isprime
    [n for n in range(3,10**4) if isprime(int(''.join([str(d) for d in range(2,n) if n%d and 2*n%d in [d-1,0,1]])))] # Chai Wah Wu, Aug 08 2014

Extensions

a(618) corrected in b-file by Paolo P. Lava, Feb 28 2018

A153023 If n is 1 or prime then a(n) = n. Otherwise, start with n and iterate the map k -> A048050(k) until we reach a prime p; then a(n) = p. If we never reach a prime, a(n) = -1. A048050 gives the sum of proper divisors of k, excluding both 1 and n from the sum.

Original entry on oeis.org

1, 2, 3, 2, 5, 5, 7, 5, 3, 7, 11, 5, 13, 3, 5, 3, 17, 7, 19, 7, 7, 13, 23, 5, 5, 5, 5, 5, 29, 41, 31, 41, 3, 19, 5, 7, 37, 7, 3, 7, 41, 53, 43, 3, 41, 5, 47, -1, 7, 53, 7, 41, 53, 7, 3, 7, 13, 31, 59, 107, 61, 3, 7, 3, 7, 7, 67, 13, 5, 73, 71, 7, 73, 3, -1, 7, 7, 89, 79, 41, 3, 43, 83, 139, 13
Offset: 1

Views

Author

Andrew Carter (acarter09(AT)newarka.edu), Dec 16 2008

Keywords

Examples

			a(18) -> {2,3,6,9} -> 20 -> {2,4,5,10} -> 21 -> {3,7} -> 10 -> {2,5} -> 7 = 7.
		

Crossrefs

Programs

  • Maple
    f := proc(n) L := {} ; a := n ; while not isprime(a) do a := A048050(a) ; if a in L then RETURN(-1) ; fi; L := L union {a} ; od; a ; end:
    A048050 := proc(n) numtheory[sigma](n)-n-1 ; end:
    A153023 := proc(n) if n =1 then 1; elif isprime(n) then n; else f(n) ; fi; end: # R. J. Mathar, Dec 19 2008
  • Mathematica
    Table[If[! CompositeQ[n], n, NestWhile[DivisorSigma[1, #] - (# + 1) &, n, Nor[PrimeQ@ #, # == 0] &, 1, 100] /. k_ /; CompositeQ@ k -> -1], {n, 85}] (* Michael De Vlieger, Nov 03 2017 *)
  • Scheme
    (define (A153023 n) (let loop ((n n) (visited (list n))) (let ((next (A048050 n))) (cond ((or (= 1 n) (= 1 (A010051 n))) n) ((member next visited) -1) (else (loop next (cons next visited)))))))
    (define (A048050 n) (if (= 1 n) 0 (- (A001065 n) 1)))
    (define (A001065 n) (- (A000203 n) n)) ;; For an implementation of A000203, see under that entry.
    ;; Antti Karttunen, Nov 03 2017

Extensions

Extended by R. J. Mathar, Dec 19 2008
Description clarified by Antti Karttunen, Nov 03 2017

A191648 a(1)=1, a(2)=1. For n > 2, start with n and iterate the map (k -> concatenation of anti-divisors of k) until we reach a prime q; then a(n) = q. If we never reach a prime, a(n) = 0.

Original entry on oeis.org

1, 1, 2, 3, 23, 3
Offset: 1

Views

Author

Paolo P. Lava, Jun 10 2011

Keywords

Comments

Similar to A120716, which uses the proper divisors of n. Other known values include a(10) = 347, a(14) = 349, and a(16) = 311. See also A191859.

Examples

			The anti-divisors of 5 are 2, 3, and 23 is prime, hence a(5) = 23.
The anti-divisors of 7 are 2, 3, 5, and 235 is composite; the anti-divisors of 235 are 2, 3, 7, 10, 67, 94, 157, and 237106794157 = 59*547*7346909 is composite; the anti-divisors of 237106794157 start 2, 3, 5, 15, 118, 1094, 1709, 4519, 61403, 64546, 7722971, 14693818, 104937727, but the others are unknown, hence a(7) is also unknown.
Note that the example speaks of the anti-divisors of 237106794157 being incomplete.  As of this date, those are well-established (see code of A066272).  It is the primality evaluation chain from anti-divisors for n=7 from 23515118109417094519614036454677229711469381810493772727748015786693526280375184463161423922194842717663158071196105 that is incomplete. - _Bill McEachen_, Dec 14 2022
		

Crossrefs

Programs

  • Maple
    antidivisors := proc(n) local a, k; a := {} ; for k from 2 to n-1 do if abs((n mod k)- k/2) < 1 then a := a union {k} ; end if; end do: a ; end proc:
    A130846 := proc(n) digcatL(sort(convert(antidivisors(n),list))) ; end proc:
    A191648 := proc(n) if n <=2 then 1; else m := A130846(n) ; while not isprime(m) do m := A130846(m) ; end do: return m; end if; end proc: # R. J. Mathar, Jun 30 2011
Showing 1-9 of 9 results.