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-7 of 7 results.

A107770 Index of greater of twin primes in the primes.

Original entry on oeis.org

3, 4, 6, 8, 11, 14, 18, 21, 27, 29, 34, 36, 42, 44, 46, 50, 53, 58, 61, 65, 70, 82, 84, 90, 99, 105, 110, 114, 117, 121, 141, 143, 145, 149, 153, 172, 174, 177, 179, 183, 191, 202, 207, 210, 213, 216, 226, 231, 235, 237, 254, 257, 263, 266, 269, 278, 287
Offset: 1

Views

Author

Roger L. Bagula, Jun 11 2005

Keywords

Comments

Numbers k such that prime(k) - prime(k-1) = 2.
Numbers k such that A062301(k) is 1. - Vincenzo Librandi, Apr 04 2018

Crossrefs

Cf. A062301.

Programs

Formula

a(n) = A029707(n) + 1. - Juri-Stepan Gerasimov, Dec 16 2009
a(n) = A000720(A006512(n)).

Extensions

Incorrect comment removed by Charles R Greathouse IV, Mar 19 2010
More terms from Harvey P. Dale, Jun 10 2014

A100810 a(n) = 0 if prime(n) + 2 = prime(n+1), otherwise 1.

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1
Offset: 1

Views

Author

Giovanni Teofilatto, Jan 05 2005

Keywords

Examples

			a(2) = 0 because prime(2) + 2 = 5 = prime(3).
a(3) = 0 because prime(3) + 2 = 7 = prime(4).
		

Programs

  • Maple
    a:= n-> `if`(isprime(ithprime(n)+2), 0, 1):
    seq(a(n), n=1..105);  # Alois P. Heinz, Oct 02 2020
  • Mathematica
    Table[If[Prime[n] + 2 == Prime[n + 1], 0, 1], {n, 120}] (* Ray Chandler, Jan 09 2005 *)
    If[#[[2]]-#[[1]]==2,0,1]&/@Partition[Prime[Range[110]],2,1] (* Harvey P. Dale, Mar 05 2016 *)

Formula

a(n) = 1 - A100821(n) = 1 - A062301(n+1).

Extensions

Corrected and extended by Ray Chandler, Jan 09 2005

A100821 a(n) = 1 if prime(n) + 2 = prime(n+1), otherwise 0.

Original entry on oeis.org

0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0
Offset: 1

Views

Author

Giovanni Teofilatto, Jan 06 2005

Keywords

Comments

Same as A062301 except for starting point.
a(n)=1 iff prime(n) is the smaller of a pair of twin primes, else a(n)=0. This sequence can be derived from the sequence b(n)=1 iff n and n+2 are both prime, else b(n)=0. This latter sequence has as its inverse Moebius transform the sequence c(n) = the number of distinct factors of n which are the smaller of a pair of twin primes. For example, c(15)=2 because 15 is divisible by 3 and 5, each of which is the smaller of a pair of twin primes. - Jonathan Vos Post, Jan 07 2005

Programs

  • Mathematica
    Table[If[Prime[n] + 2 == Prime[n + 1], 1, 0], {n, 120}] (* Ray Chandler, Jan 09 2005 *)

Formula

a(n) = A062301(n+1) = 1 - A100810(n).

Extensions

Corrected and extended by Ray Chandler, Jan 09 2005

A309332 Number of ways the n-th triangular number T(n) = A000217(n) can be written as the sum of two positive triangular numbers.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 2, 0, 3, 0, 0, 1, 1, 3, 0, 0, 1, 0, 1, 0, 0, 3, 1, 1, 0, 1, 3, 0, 1, 1, 1, 2, 0, 1, 2, 0, 1, 1, 2, 1, 1, 1, 1, 2, 1, 0, 3, 1, 1, 1, 0, 3, 1, 1, 0, 0, 2, 0, 1, 1, 1, 1, 1, 5, 0, 1, 1, 0, 1, 0, 0, 3, 0, 3, 1, 0, 3, 1, 3, 1, 3, 3, 0, 1, 0, 0, 3, 0, 2, 0, 1
Offset: 1

Views

Author

Alois P. Heinz, Aug 01 2019

Keywords

Comments

The order doesn't matter. 21 = 6+15 = 15+6 are not counted as distinct solutions. - N. J. A. Sloane, Feb 22 2020

Examples

			a(3) = 1: 2*3/2 + 2*3/2 = 3*4/2.
a(21) = 2: 6*7/2 + 20*21/2 = 12*13/2 + 17*18/2 = 21*22/2.
a(23) = 3: 9*10/2 + 21*22/2 = 11*12/2 + 20*21/2 = 14*15/2 + 18*19/2 = 23*24/2.
		

Crossrefs

Cf. A000217, A001652, A012132, A027861, A046080 (the same for squares), A053141, A062301 (the same for primes), A108769, A309507.

Programs

  • Maple
    a:= proc(n) local h, j, r, w; h, r:= n*(n+1), 0;
          for j from n-1 by -1 do w:= j*(j+1);
            if 2*w
    				
  • Mathematica
    a[n_] := Module[{h = n(n+1), j, r = 0, w}, For[j = n-1, True, j--, w = j(j+1); If[2w < h, Break[]]; If[ IntegerQ[Sqrt[4(h-w)+1]], r++]]; r];
    Table[a[n], {n, 1, 120}] (* Jean-François Alcover, Nov 16 2022, after Alois P. Heinz *)

Formula

a(n) > 0 <=> n in { A012132 }.
a(n) = 0 <=> n in { A027861 }.
a(n) = 1 <=> n in { A108769 }.

A322975 Number of divisors d of n such that d-2 is prime.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 04 2019

Keywords

Examples

			10395 has 32 divisors: [1, 3, 5, 7, 9, 11, 15, 21, 27, 33, 35, 45, 55, 63, 77, 99, 105, 135, 165, 189, 231, 297, 315, 385, 495, 693, 945, 1155, 1485, 2079, 3465, 10395]. When 2 is subtracted from each, as 1-2 = -1, 3-2 = 1, 5-2 = 3, etc, the only differences that are primes are: [3, 5, 7, 13, 19, 31, 43, 53, 61, 97, 103, 163, 229, 313, 383, 691, 1153, 1483, 3463], thus (a10395) = 19.
		

Crossrefs

Programs

  • Mathematica
    Array[DivisorSum[#, 1 &, PrimeQ[# - 2] &] &, 105] (* Michael De Vlieger, Jan 04 2019 *)
  • PARI
    A322975(n) = sumdiv(n, d, isprime(d-2));

Formula

a(n) = Sum_{d|n, d>2} A010051(d-2).
a(A000040(n)) = A062301(n).

A336409 Distance from prime(n) to the nearest odd composite that is < prime(n).

Original entry on oeis.org

2, 4, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 2, 2, 4, 2, 4, 2, 4, 2, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 2, 2, 4
Offset: 5

Views

Author

Clark Kimberling, Sep 06 2020

Keywords

Examples

			Beginning with prime(5) = 11:  11-9 = 2, 13-9 = 4, 17-15 = 2, 19-15 = 4.
		

Crossrefs

Programs

  • Maple
    A336409 := proc(n)
        local p;
        p := ithprime(n) ;
        for a from p-2 by -2 do
            if not isprime(a) then
                return p-a ;
            end if;
        end do:
    end proc:
    seq(A336409(n),n=5..100) ; # R. J. Mathar, Oct 02 2020
    # second Maple program:
    a:= n-> `if`(isprime(ithprime(n)-2), 4, 2):
    seq(a(n), n=5..100);  # Alois P. Heinz, Oct 02 2020
  • Mathematica
    z = 5000; d = Select[Range[2, z], ! PrimeQ@# && OddQ@# &];  (* A014076 *)
    f[n_] := Select[d, # < Prime[n] &];
    t = Table[Prime[n] - Max[f[n]], {n, 5, 300}]  (* A336409 *)
    Flatten[Position[t, 2]]  (* A336410 *)
    Flatten[Position[t, 4]]  (* A336411 *)

Formula

a(n) = 2 * A175191(n-1). - Alois P. Heinz, Oct 02 2020
a(n) = 2 * (A062301(n) + 1). - Hugo Pfoertner, Oct 02 2020

A340001 Number of ways prime(n) is a sum of five distinct primes.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 5, 6, 11, 14, 16, 25, 29, 39, 57, 68, 75, 88, 92, 109, 169, 198, 235, 240, 322, 331, 379, 437, 497, 565, 635, 634, 803, 798, 896, 888, 1091, 1328, 1477, 1444, 1616, 1753, 1730, 2080, 2262, 2452, 2627, 2588, 2790, 3043, 3004, 3535
Offset: 1

Views

Author

Michel Lagneau, Dec 26 2020

Keywords

Comments

Conjecture: all primes >= 43 are the sum of five distinct primes.
The sequence of the prime numbers that are the sum of five distinct prime numbers begins with 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, ...
The primes in the sequence are 2, 5, 11, 29, 109, 331, 379, 1091, 1753, ...
The squares in the sequence are 0, 1, 16, 25, 169, 1444, ...

Examples

			a(14) = 1 because prime(14) = 43 = 3 + 5 + 7 + 11 + 17.
a(17) = 5 because prime(17) = 59 = 3 + 5 + 7 + 13 + 31 = 3 + 5 + 11 + 17 + 23 = 3 + 7 + 13 + 17 + 19 = 5 + 7 + 11 + 13 + 23 = 5 + 7 + 11 + 17 + 19.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; series(`if`(n=0, 1,
          `if`(i<1, 0, b(n, i-1)+(p-> `if`(p>n, 0,
           x*b(n-p, i-1)))(ithprime(i)))), x, 6)
        end:
    a:= n-> coeff(b(ithprime(n), n), x, 5):
    seq(a(n), n=1..100);  # Alois P. Heinz, Dec 30 2020
  • Mathematica
    b[n_, i_] := b[n, i] = Series[If[n == 0, 1,
         If[i < 1, 0, b[n, i - 1] + Function[p, If[p > n, 0,
         x*b[n - p, i - 1]]][Prime[i]]]], {x, 0, 6}];
    a[n_] := SeriesCoefficient[b[Prime[n], n], {x, 0, 5}];
    Array[a, 100] (* Jean-François Alcover, Apr 26 2021, after Alois P. Heinz *)
    Table[Length[Select[IntegerPartitions[p,{5}],AllTrue[#,PrimeQ]&&Length[Union[#]]==5&]],{p,Prime[Range[70]]}] (* Harvey P. Dale, Jul 07 2024 *)

Formula

a(n) = A219199(A000040(n)).
a(n) = [x^prime(n)*y^5] Product_{i>=1} (1+x^prime(i)*y). - Alois P. Heinz, Dec 30 2020
Showing 1-7 of 7 results.