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.

A031439 a(0) = 1, a(n) is the greatest prime factor of a(n-1)^2+1 for n > 0.

Original entry on oeis.org

1, 2, 5, 13, 17, 29, 421, 401, 53, 281, 3037, 70949, 1713329, 1467748131121, 37142837524296348426149, 101591133424866642486477019709, 1650979973845742266714536305651329, 78343914631785958284737, 4029445531112797145738746391569, 350080544438648120162733678636001, 26208090024628793745288451837610346882122253572537, 4717815978577117335515270825550279551117660519482308365269206484133871485221
Offset: 0

Views

Author

Keywords

Comments

Does this sequence grow indefinitely, or does it cycle? - Franklin T. Adams-Watters, Oct 02 2006
All a(n) except a(0) = 1 belong to A014442(n) = {2, 5, 5, 17, 13, 37, 5, 13, 41, 101, ...} Largest prime factor of n^2 + 1. All a(n) except a(0) = 1 belong to A002313(n) = {2, 5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97, 101, ...} Primes congruent to 1 or 2 modulo 4; or, primes of form x^2+y^2; or, -1 is a square mod p. All a(n) except a(0) = 1 and a(1) = 2 are the Pythagorean primes A002144(n) = {5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97, 101, ...} Primes of form 4n+1. - Alexander Adamchuk, Nov 05 2006
Essentially the same as A072268; A072268(n) = A031439(n-1)^2 + 1. - Charles R Greathouse IV, May 08 2009

Examples

			a(16)=A006530(a(15)^2+1)=
A006530(101591133424866642486477019709^2+1)=
A006530(10320758390549056348725939119133160378521185060950774444682)=
A006530(2*29*23201*4645528280970018601*1650979973845742266714536305651329)=
1650979973845742266714536305651329, factorization of A006530(a(15)^2+1) by Dario A. Alpern's program (see link).
		

Crossrefs

Cf. A002144 - Pythagorean primes: primes of form 4n+1; A002313 - Primes congruent to 1 or 2 modulo 4; A014442 - Largest prime factor of n^2 + 1.

Programs

  • Mathematica
    gpf[n_] := FactorInteger[n][[-1, 1]]; a[0] = 1; a[n_] := a[n] = gpf[a[n - 1]^2 + 1]; Table[an = a[n]; Print[an]; an, {n, 0, 21}] (* Jean-François Alcover, Nov 04 2011 *)
    NestList[FactorInteger[#^2+1][[-1,1]]&,1,21] (* Harvey P. Dale, Jul 04 2013 *)
  • PARI
    gpf(n)=local(pf);pf=factor(n);pf[matsize(pf)[1],1] vector(20,i,r=if(i==1,1,gpf(r^2+1)))

Extensions

One more term from Vladeta Jovovic, Nov 26 2001
a(16) from Reinhard Zumkeller, Aug 07 2004
a(17)-a(21) from Richard FitzHugh (fitzhughrichard(AT)hotmail.com), Aug 12 2004

A379652 a(1) = 2. For n > 1, a(n) = smallest prime factor of c=2*a(n-1)+1 that is not in {a(1), ..., a(n-1)}; if all prime factors of c are in {a(1), ..., a(n-1)}, then we try the next value of c, which is 2*c+1; and so on.

Original entry on oeis.org

2, 5, 11, 23, 47, 19, 3, 7, 31, 127, 17, 71, 13, 37, 151, 101, 29, 59, 239, 479, 137, 1103, 2207, 883, 2357, 41, 83, 167, 67, 271, 181, 727, 97, 1567, 6271, 113, 227, 911, 1823, 521, 149, 599, 109, 73, 197, 79, 53, 107, 43, 563, 347, 139, 373, 997, 307, 1231
Offset: 1

Views

Author

Robert C. Lyons, Dec 28 2024

Keywords

Comments

The following are some statistics about how many terms of the sequence are required, so that the first k primes are included:
- The first 10^2 terms include the first 17 primes.
- The first 10^3 terms include the first 131 primes.
- The first 10^4 terms include the first 808 primes.
- The first 10^5 terms include the first 4397 primes.
- The first 10^6 terms include the first 35801 primes.
- The first 10^7 terms include the first 253682 primes.
Conjecture: this sequence is a permutation of the primes.
If we start with 1 instead of 2 we get A379727. - N. J. A. Sloane, Dec 31 2024

Examples

			a(6) is 19 because the prime factors of c=2*a(5)+1 (i.e., 95) are 5 and 19, and 5 already appears in the sequence as a(2).
a(9) is 31 because the prime factors of c=2*a(8)+1 (i.e., 15) are 3 and 5 which already appear in the sequence as a(7) and a(2). The next value of c (i.e., 2*c+1) is 31, which is prime and does not already appear in the sequence.
		

Crossrefs

Programs

  • Mathematica
    c[_] := True; j = 2; c[2] = False;
    {j}~Join~Reap[Do[m = 2*j + 1;
      While[Set[k, SelectFirst[FactorInteger[m][[All, 1]], c] ];
        !IntegerQ[k],
        m = 2*m + 1];
      c[k] = False; j = Sow[k], {120}] ][[-1, 1]] (* Michael De Vlieger, Dec 29 2024 *)
  • Python
    from sympy import primefactors
    seq = [2]
    seq_set = set(seq)
    max_seq_len=100
    while len(seq) <= max_seq_len:
        c = seq[-1]
        done = False
        while not done:
            c = 2*c+1
            factors = primefactors(c)
            for factor in factors:
                if factor not in seq_set:
                    seq.append(factor)
                    seq_set.add(factor)
                    done = True
                    break
    print(seq)

A379899 a(1) = 2. For n > 1, a(n) = smallest prime factor of c=a(n-1)+4 that is not in {a(1), ..., a(n-1)}; if all prime factors of c are in {a(1), ..., a(n-1)}, then we try the next value of c, which is c+4; and so on.

Original entry on oeis.org

2, 3, 7, 11, 5, 13, 17, 29, 37, 41, 53, 19, 23, 31, 43, 47, 59, 67, 71, 79, 83, 103, 107, 127, 131, 139, 151, 163, 167, 179, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 313, 317, 337, 349, 353, 373
Offset: 1

Views

Author

Robert C. Lyons, Jan 05 2025

Keywords

Comments

The following are some statistics about how many terms of the sequence are required, so that the first k primes are included:
- The first 10^2 terms include the first 95 primes.
- The first 10^3 terms include the first 697 primes.
- The first 10^4 terms include the first 6783 primes.
- The first 10^5 terms include the first 98563 primes.
Conjecture: this sequence is a permutation of the primes.

Examples

			a(2) is 3 because the prime factors of c=a(1)+4 (i.e., 6) are 2 and 3, and 2 already appears in the sequence as a(1).
a(6) is 13 because the only prime factor of c=a(5)+4 (i.e., 9) is 3 which already appears in the sequence as a(2). The next value of c (i.e., c+4) is 13, which is prime and does not already appear in the sequence.
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n<1, {}, b(n-1) union {a(n)}) end:
    a:= proc(n) option remember; local c, p; p:= infinity;
          for c from a(n-1)+4 by 4 while p=infinity do
            p:= min(numtheory[factorset](c) minus b(n-1)) od; p
        end: a(1):=2:
    seq(a(n), n=1..200);  # Alois P. Heinz, Jan 11 2025
  • Mathematica
    nn = 120; c[_] := True; j = 2; s = 4; c[2] = False;
    Reap[Do[m = j + s;
      While[k = SelectFirst[FactorInteger[m][[All, 1]], c];
        ! IntegerQ[k], m += s];
    c[k] = False; j = Sow[k], {nn}] ][[-1, 1]] (* Michael De Vlieger, Jan 11 2025 *)
  • Python
    from sympy import primefactors
    seq = [2]
    seq_set = set(seq)
    max_seq_len=100
    while len(seq) <= max_seq_len:
        c = seq[-1]
        done = False
        while not done:
            c = c + 4
            factors = primefactors(c)
            for factor in factors:
                if factor not in seq_set:
                    seq.append(factor)
                    seq_set.add(factor)
                    done = True
                    break
    print(seq)

A120685 Integers m such that the sequence defined by f(0)=m and f(n+1)=1+gpf(f(n)), with gpf(n) being the greatest prime factor of n (A006530), ends up in the repetitive cycle 4 -> 3 -> 4 -> ...

Original entry on oeis.org

2, 4, 5, 8, 10, 11, 13, 15, 16, 17, 20, 22, 23, 25, 26, 30, 32, 33, 34, 37, 39, 40, 41, 44, 45, 46, 47, 50, 51, 52, 53, 55, 60, 61, 64, 65, 66, 68, 69, 71, 74, 75, 77, 78, 80, 82, 83, 85, 88, 90, 91, 92, 94, 97, 99, 100, 102, 104, 106, 107, 110, 111, 113, 115, 117, 119, 120
Offset: 0

Views

Author

Carlos Alves, Jun 25 2006

Keywords

Comments

Let f(0)=m; f(n+1)=1+gpf(f(n)), where gpf(n) is the greatest prime factor of n (A006530). For any m, for sufficiently large n the sequence f(n) oscillates between 3 and 4. Given a sufficiently large n, this allows us to divide integers in two classes: C3 (m such that the sequence f(n) enters the cycle 3, 4, 3, ...) and C4 (m such that the sequence f(n) enters the cycle 4, 3, 4, ...). We present here C4 as the one that begin with 4. In A120684 we present C3 as the one that begin with 3.

Examples

			Oscillation between 3 and 4: 1+gpf(3)=1+3=4; 1+gpf(4)=1+2=3.
Other value, e.g. 7: 1+gpf(7)=1+7=8; 1+gpf(8)=1+2=3 (7 belongs to C3).
Other value, e.g. 20: 1+gpf(20)=1+5=6; 1+gpf(6)=1+3=4 (20 belongs to C4).
		

Crossrefs

Programs

  • Mathematica
    f = Function[n, FactorInteger[n][[ -1, 1]] + 1]; mn = Map[(NestList[f, #, 8][[ -1]]) &, Range[2, 500]]; out = Flatten[Position[mn, 4]] + 1

Extensions

Edited by Michel Marcus, Feb 25 2013

A120684 Integers m such that the sequence defined by f(0)=m and f(n+1)=1+gpf(f(n)), with gpf(n) being the greatest prime factor of n (A006530), ends up in the repetitive cycle 3 -> 4 -> 3 -> ...

Original entry on oeis.org

3, 6, 7, 9, 12, 14, 18, 19, 21, 24, 27, 28, 29, 31, 35, 36, 38, 42, 43, 48, 49, 54, 56, 57, 58, 59, 62, 63, 67, 70, 72, 73, 76, 79, 81, 84, 86, 87, 89, 93, 95, 96, 98, 101, 103, 105, 108, 109, 112, 114, 116, 118, 124, 126, 127, 129, 131, 133, 134, 137, 140, 144, 145, 146
Offset: 0

Views

Author

Carlos Alves, Jun 25 2006

Keywords

Comments

Let f(0)=m; f(n+1)=1+gpf(f(n)), where gpf(n) is the greatest prime factor of n (A006530). For any m, for sufficiently large n the sequence f(n) oscillates between 3 and 4. Given a sufficiently large n, this allows us to divide integers in two classes: C3 (m such that the sequence f(n) enters the cycle 3, 4, 3, ...) and C4 (m such that the sequence f(n) enters the cycle 4, 3, 4, ...). We present here C3 as the one that begin with 3. In A120685 we present C4 as the one that begin with 4.

Examples

			Oscillation between 3 and 4: 1+gpf(3)=1+3=4; 1+gpf(4)=1+2=3.
Other value, e.g. 7: 1+gpf(7)=1+7=8; 1+gpf(8)=1+2=3 (7 belongs to C3).
Other value, e.g. 20: 1+gpf(20)=1+5=6; 1+gpf(6)=1+3=4 (20 belongs to C4).
		

Crossrefs

Programs

  • Mathematica
    f = Function[n, FactorInteger[n][[ -1, 1]] + 1]; mn = Map[(NestList[f, #, 8][[ -1]]) &, Range[2, 500]]; out = Flatten[Position[mn, 3]] + 1

Extensions

Edited by Michel Marcus, Feb 23 2013

A120686 Integers m such that the sequence defined by f(0)=m and f(n+1)=2+gpf(f(n)), with gpf(n) being the greatest prime factor of n (A006530), ends up in the period 3 cycle 5 -> 7 -> 9 -> 5 -> ...

Original entry on oeis.org

5, 10, 15, 19, 20, 25, 30, 31, 38, 40, 45, 47, 50, 53, 57, 60, 61, 62, 75, 76, 80, 90, 93, 94, 95, 97, 100, 103, 106, 109, 114, 120, 122, 124, 125, 133, 135, 141, 149, 150, 152, 155, 159, 160, 163, 171, 173, 180, 183, 186, 188, 190, 191, 194, 199, 200
Offset: 0

Views

Author

Carlos Alves, Jun 25 2006

Keywords

Comments

Let f(0)=m; f(n+1)= c + d gpf(f(n)), where gpf(n) is the largest prime factor of n (A006530). For any m, for sufficiently large n the sequence f(n) oscillates. In A120684, A120685 the values d=c=1 were considered. Here we consider d=1, c=2 and this allows us to divide integers in 4 classes: C4 (m such that f(n)=4, which is a fixed point); C5 (m such that f(n)=5, then oscillates between 5,7,9); C7 (m such that f(n)=7, then oscillates between 7,9,5); C9 (m such that f(n)=9, then oscillates between 9,5,7); In A120686 (here) we present C5 as the one that includes 5. In A120687 we present C7 as the one that includes 7. In A120688 we present C9 as the one that includes 9.
Note that if f(n) is not prime then f(n+1)= 2 + gpf(f(n)) <= 2 + f(n)/2 and the sequence decreases. If f(n) is prime and 2+f(n) is prime, the sequence will decrease when 2k+f(n) is not prime, which must occur for k>2. The bottom limit case is the cycle (5 7 9). The only other possibility occurs for 2^k numbers that go to the fixed point 4 because 2+gpf(2^k)=2+2=4.

Examples

			Oscillation between 5,7,9: 2+gpf(5)=2+5=7; 2+gpf(7)=2+7=9; 2+gpf(9)=2+3=5.
Fixed point is 4: 2+gpf(4)=2+2=4.
		

Crossrefs

Programs

  • Mathematica
    fi = Function[n, FactorInteger[n][[ -1, 1]] + 2]; mn = Map[(NestList[fi, #, 6][[ -1]]) &, Range[2, 200]]; Cc4 = Flatten[Position[mn, 4]] + 1;Cc5 = Flatten[Position[mn, 5]] + 1; Cc7 = Flatten[Position[mn, 7]] + 1;Cc9 = Flatten[Position[mn, 9]] + 1; Cc5

A120687 Integers m such that the sequence defined by f(0)=m and f(n+1)=2+gpf(f(n)), with gpf(n) being the greatest prime factor of n (A006530), ends up in the period 3 cycle 7 -> 9 -> 5 -> 7 -> ...

Original entry on oeis.org

7, 11, 14, 21, 22, 28, 33, 35, 37, 41, 42, 44, 49, 55, 56, 63, 66, 67, 70, 71, 74, 77, 79, 82, 83, 84, 88, 89, 98, 99, 105, 110, 111, 112, 113, 121, 123, 126, 127, 132, 134, 137, 140, 142, 147, 148, 151, 154, 158, 164, 165, 166, 167, 168, 175, 176, 178, 179, 185, 189
Offset: 0

Views

Author

Carlos Alves, Jun 25 2006

Keywords

Comments

Let f(0)=m; f(n+1)= c + d gpf(f(n)), where gpf(n) is the largest prime factor of n (A006530). For any m, for sufficiently large n the sequence f(n) oscillates. In A120684, A120685 the values d=c=1 were considered. Here we consider d=1, c=2 and this allows us to divide integers in 4 classes: C4 (m such that f(n)=4, which is a fixed point); C5 (m such that f(n)=5, then oscillates between 5,7,9); C7 (m such that f(n)=7, then oscillates between 7,9,5); C9 (m such that f(n)=9, then oscillates between 9,5,7); In A120686 we present C5 as the one that includes 5. In A120687 (here) we present C7 as the one that includes 7. In A120688 we present C9 as the one that includes 9.
Note that if f(n) is not prime then f(n+1)= 2 + gpf(f(n)) <= 2 + f(n)/2 and the sequence decreases. If f(n) is prime and 2+f(n) is prime, the sequence will decrease when 2k+f(n) is not prime, which must occur for k>2. The bottom limit case is the cycle (5 7 9). The only other possibility occurs for 2^k numbers that go to the fixed point 4 because 2+gpf(2^k)=2+2=4.

Examples

			Oscillation between 5,7,9: 2+gpf(5)=2+5=7; 2+gpf(7)=2+7=9; 2+gpf(9)=2+3=5.
Fixed point is 4: 2+gpf(4)=2+2=4.
		

Crossrefs

Programs

  • Mathematica
    fi = Function[n, FactorInteger[n][[ -1, 1]] + 2]; mn = Map[(NestList[fi, #, 6][[ -1]]) &, Range[2, 200]]; Cc4 = Flatten[Position[mn, 4]] + 1;Cc5 = Flatten[Position[mn, 5]] + 1; Cc7 = Flatten[Position[mn, 7]] + 1;Cc9 = Flatten[Position[mn, 9]] + 1; Cc7

A120688 Integers m such that the sequence defined by f(0)=m and f(n+1)=2+gpf(f(n)), with gpf(n) being the greatest prime factor of n (A006530), ends up in the period 3 cycle 9 -> 5 -> 7 -> 9 -> ...

Original entry on oeis.org

3, 6, 9, 12, 13, 17, 18, 23, 24, 26, 27, 29, 34, 36, 39, 43, 46, 48, 51, 52, 54, 58, 59, 65, 68, 69, 72, 73, 78, 81, 85, 86, 87, 91, 92, 96, 101, 102, 104, 107, 108, 115, 116, 117, 118, 119, 129, 130, 131, 136, 138, 139, 143, 144, 145, 146, 153, 156, 157, 161, 162
Offset: 0

Views

Author

Carlos Alves, Jun 25 2006

Keywords

Comments

Let f(0)=m; f(n+1)= c + d gpf(f(n)), where gpf(n) is the largest prime factor of n (A006530). For any m, for sufficiently large n the sequence f(n) oscillates. In A120684, A120685 the values d=c=1 were considered. Here we consider d=1, c=2 and this allows us to divide integers in 4 classes: C4 (m such that f(n)=4, which is a fixed point); C5 (m such that f(n)=5, then oscillates between 5,7,9); C7 (m such that f(n)=7, then oscillates between 7,9,5); C9 (m such that f(n)=9, then oscillates between 9,5,7); In A120686 we present C5 as the one that includes 5. In A120687 we present C7 as the one that includes 7. In A120688 (here) we present C9 as the one that includes 9.
Note that if f(n) is not prime then f(n+1)= 2 + gpf(f(n)) <= 2 + f(n)/2 and the sequence decreases. If f(n) is prime and 2+f(n) is prime, the sequence will decrease when 2k+f(n) is not prime, which must occur for k>2. The bottom limit case is the cycle (5 7 9). The only other possibility occurs for 2^k numbers that go to the fixed point 4 because 2+gpf(2^k)=2+2=4.

Examples

			Oscillation between 5,7,9: 2+gpf(5)=2+5=7; 2+gpf(7)=2+7=9; 2+gpf(9)=2+3=5.
Fixed point is 4: 2+gpf(4)=2+2=4.
		

Crossrefs

Programs

  • Mathematica
    fi = Function[n, FactorInteger[n][[ -1, 1]] + 2]; mn = Map[(NestList[fi, #, 6][[ -1]]) &, Range[2, 200]]; Cc4 = Flatten[Position[mn, 4]] + 1;Cc5 = Flatten[Position[mn, 5]] + 1; Cc7 = Flatten[Position[mn, 7]] + 1;Cc9 = Flatten[Position[mn, 9]] + 1; Cc9

A379775 a(1) = 2. For n > 1, a(n) = smallest prime factor of c=2*a(n-1)-1 that is not in {a(1), ..., a(n-1)}; if all prime factors of c are in {a(1), ..., a(n-1)}, then we try the next value of c, which is 2*c-1; and so on.

Original entry on oeis.org

2, 3, 5, 17, 11, 7, 13, 97, 193, 769, 29, 19, 37, 73, 577, 1153, 461, 307, 613, 31, 61, 241, 113, 449, 23, 89, 59, 233, 929, 619, 1237, 2473, 43, 337, 673, 269, 179, 211, 421, 41, 107, 71, 47, 67, 53, 139, 277, 79, 157, 313, 1249, 227, 151, 601, 1201, 4801
Offset: 1

Views

Author

Robert C. Lyons, Jan 02 2025

Keywords

Comments

The following are some statistics about how many terms of the sequence are required, so that the first k primes are included:
- The first 10^2 terms include the first 28 primes.
- The first 10^3 terms include the first 92 primes.
- The first 10^4 terms include the first 710 primes.
- The first 10^5 terms include the first 4848 primes.
- The first 10^6 terms include the first 29442 primes.
- The first 10^7 terms include the first 260324 primes.
Conjecture: this sequence is a permutation of the primes.

Examples

			a(6) is 7 because the prime factors of c=2*a(5)-1 (i.e., 21) are 3 and 7, and 3 already appears in the sequence as a(2).
a(8) is 97 because the only prime factor of c=2*a(7)-1 (i.e., 25) is 5 which already appears in the sequence as a(3). The next value of c (i.e., 2*c-1) is 49; its only prime factor is 7 which already appears in the sequence as a(6). The next value of c (i.e., 2*c-1) is 97, which is prime and does not already appear in the sequence.
		

Crossrefs

Programs

  • Python
    from sympy import primefactors
    seq = [2]
    seq_set = set(seq)
    max_seq_len=100
    while len(seq) <= max_seq_len:
        c = seq[-1]
        done = False
        while not done:
            c = 2*c-1
            factors = primefactors(c)
            for factor in factors:
                if factor not in seq_set:
                    seq.append(factor)
                    seq_set.add(factor)
                    done = True
                    break
    print(seq)
Showing 1-9 of 9 results.