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.

User: Andres Cicuttin

Andres Cicuttin's wiki page.

Andres Cicuttin has authored 106 sequences. Here are the ten most recent ones:

A368420 a(n) = a(n-1) - floor(mean(a)) + ceiling(std(a)) where a(0) = 0, a(1) = 2, and mean(a) and std(a) are respectively the mean and the standard deviation of all previous terms.

Original entry on oeis.org

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

Author

Andres Cicuttin, Dec 23 2023

Keywords

Comments

The linear-log plot of the sequence shows a curious periodic pattern. Does this pattern continue indefinitely?

Programs

  • Mathematica
    a={0,2};
    Do[AppendTo[a,Last[a]-Floor[Mean[a]]+Ceiling@StandardDeviation[a]],{j,1,100}]

A365819 a(n) = a(n-1) - 1 + floor(median(a) - mean(a)) where a(0) = 0, a(1) = 1, and median(a) and mean(a) are respectively the median and mean of all previous terms.

Original entry on oeis.org

0, 1, 0, -2, -3, -4, -5, -7, -8, -9, -10, -11, -12, -13, -15, -17, -19, -21, -22, -23, -24, -25, -26, -27, -27, -27, -27, -27, -28, -29, -31, -33, -36, -39, -43, -47, -51, -54, -57, -59, -61, -63, -64, -65, -65, -65, -65, -64, -63, -61, -58, -55, -51, -47, -43, -39, -35, -31, -28, -25, -22, -19
Offset: 0

Author

Andres Cicuttin, Dec 14 2023

Keywords

Comments

The median of an even number of terms is taken as the mean of its middle two values, (x+y)/2.
The sequence seems to present a chaotic pattern. What is its asymptotic behavior?

Programs

  • MATLAB
    function a = A365819( max_n )
        a = [0 1];
        for n = 3:max_n
            a(n) = a(n-1) - 1 + floor(median(a) - mean(a));
        end
    end % Thomas Scheuerle, Dec 15 2023
  • Maple
    R:= [0,1]:
    for i from 2 to 10000 do
      v:= R[-1] - 1 + floor(Statistics:-Median(R) - Statistics:-Mean(R));
      R:= [op(R),v]
    od:
    R; # Robert Israel, Oct 14 2024
  • Mathematica
    a = {0, 1};
    Do[AppendTo[a, Last[a] - 1 + Floor[Median[a] - Mean[a]]], {j, 1, 100}]
    a[[1 ;; 100]]

A367077 Determinant of the n X n matrix whose terms are the n^2 values of isprime(x) from 1 to n^2.

Original entry on oeis.org

0, -1, -1, 0, 1, 0, -2, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0, -15, 0, 0, 0, 0, 0, 400, 0, -196, 0, 0, 0, 0, 0, 4224, 0, 0, 0, -44304, 0, -537138, 0, 0, 0, -4152330, 0, 0, 0, 0, 0, -59171526, 0, 0, 0, 0, 0, -1681340912, 0, 330218571840, 0, 0, 0, 0, 0, -349982854480, 0, 0, 0
Offset: 1

Author

Andres Cicuttin, Nov 05 2023

Keywords

Comments

Traces of these matrices are A221490.
Consider the sequence b(n) defined as 0 when a(n) is 0 and 1 otherwise. What is the value of the limit as n approaches infinity of Sum_{j<=n} b(j)/n provided that this limit exists?

Examples

			For n=4, we consider the first n^2=16 terms of the characteristic function of primes (A010051): (0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0). These terms form a matrix by arranging them in 4 consecutive subsequences of 4 terms each:
  0, 1, 1, 0;
  1, 0, 1, 0;
  0, 0, 1, 0;
  1, 0, 0, 0;
and the determinant of this matrix is zero, so a(4)=0.
		

Crossrefs

Programs

  • Mathematica
    mat[n_,i_,j_]:=Boole[PrimeQ[(i-1)*n+j]];
    a[n_]:=Det@Table[mat[n,i,j],{i,1,n},{j,1,n}];
    Table[a[n],{n,1,70}]
  • PARI
    a(n) = matdet(matrix(n, n, i, j, isprime((i-1)*n+j))); \\ Michel Marcus, Nov 07 2023
    
  • Python
    from sympy import Matrix, isprime
    def A367077(n): return Matrix(n,n,[int(isprime(i)) for i in range(1,n**2+1)]).det() # Chai Wah Wu, Nov 16 2023

A367133 Rank of the n X n matrix whose terms are the n^2 values of isprime(x) from 1 to n^2.

Original entry on oeis.org

0, 2, 3, 3, 5, 3, 7, 5, 7, 5, 11, 5, 11, 7, 9, 9, 16, 7, 19, 9, 13, 11, 23, 9, 20, 13, 19, 13, 29, 9, 31, 17, 21, 17, 25, 13, 37, 19, 25, 17, 41, 13, 43, 21, 25, 23, 47, 17, 43, 21, 33, 25, 53, 19, 41, 25, 37, 29, 59, 17, 61, 31, 37, 33, 49, 21, 67, 33, 45, 25
Offset: 1

Author

Andres Cicuttin, Nov 06 2023

Keywords

Comments

Traces of these matrices are A221490.

Examples

			For n=4, we consider the first n^2=16 terms of the characteristic function of primes (A010051): (0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0). These terms form a matrix by arranging them in 4 consecutive subsequences of 4 terms each:
  0, 1, 1, 0;
  1, 0, 1, 0;
  0, 0, 1, 0;
  1, 0, 0, 0;
and the largest square submatrix with a nonzero determinant within this matrix is of dimension 3. Therefore, the rank is 3, and so a(4)=3.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local i; LinearAlgebra:-Rank(Matrix(n,n,[seq(`if`(isprime(i),1,0),i=1..n^2)])) end proc:
    map(f, [$1..100]); # Robert Israel, Nov 11 2023
  • Mathematica
    mat[n_,i_,j_]:=Boole[PrimeQ[(i-1)*n+j]];
    a[n_]:=MatrixRank@Table[mat[n,i,j],{i,1,n},{j,1,n}];
    Table[a[n],{n,1,70}]
  • PARI
    a(n) = matrank(matrix(n, n, i, j, isprime((i-1)*n+j))); \\ Michel Marcus, Nov 07 2023
    
  • Python
    from sympy import Matrix, isprime
    def A367133(n): return Matrix(n,n,[int(isprime(i)) for i in range(1,n**2+1)]).rank() # Chai Wah Wu, Nov 16 2023

A364633 a(n) is the smallest nonnegative number k such that prime(n) + k is divisible by n + 1.

Original entry on oeis.org

0, 0, 3, 3, 1, 1, 7, 8, 7, 4, 5, 2, 1, 2, 1, 15, 13, 15, 13, 13, 15, 13, 13, 11, 7, 7, 9, 9, 11, 11, 1, 1, 33, 1, 31, 34, 33, 32, 33, 32, 31, 34, 29, 32, 33, 36, 29, 22, 23, 26, 27, 26, 29, 24, 23, 22, 21, 24, 23, 24, 27, 22, 13, 14, 17, 18, 9, 8, 3, 6, 7, 6, 3, 2, 1, 2, 1
Offset: 1

Author

Andres Cicuttin, Jul 30 2023

Keywords

Comments

The sequence presents a pattern with large discontinuities at regular intervals in the logarithmic plot (See plots in Links).

Examples

			The following table shows the first 10 terms where the fourth column, a(n), plus the third column, prime(n), is divisible by the second column n+1:
   n   n+1 prime(n) a(n)
   1    2     2       0
   2    3     3       0
   3    4     5       3
   4    5     7       3
   5    6    11       1
   6    7    13       1
   7    8    17       7
   8    9    19       8
   9   10    23       7
  10   11    29       4
		

Crossrefs

Cf. A068901.

Programs

  • Mathematica
    a[n_]:=Module[{k},k=0;
    While[Mod[Prime[n]+k,n+1]!=0,k++];k];
    Table[a[n],{n,1,70}]
  • PARI
    a(n) = my(k=0, p=prime(n)); while ((p+k) % (n+1), k++); k; \\ Michel Marcus, Sep 05 2023
  • Python
    from sympy import prime
    def A364633(n): return (n+1)*(prime(n)//(n+1)+1)-prime(n) if n>2 else 0 # Chai Wah Wu, Sep 04 2023
    

Formula

a(n) = Min_{k | (n+1) divides (prime(n)+k)}.
a(n) = (n+1)*ceiling(prime(n)/(n+1)) - prime(n)

A363321 Number of fractions of the Farey sequence of order n, F_n, that coincide with those of the sequence of the #{F_n} equally distributed fractions between 0 and 1.

Original entry on oeis.org

2, 3, 3, 5, 5, 7, 5, 3, 9, 7, 9, 3, 3, 7, 17, 17, 15, 11, 13, 11, 19, 15, 5, 25, 21, 5, 11, 17, 25, 3, 7, 13, 5, 29, 27, 41, 35, 33, 7, 17, 7, 3, 5, 3, 3, 23, 17, 5, 19, 15, 25, 9, 35, 47, 29, 5, 31, 3, 7, 27, 9, 5, 5, 61, 5, 9, 23, 41, 51, 15, 29, 3, 9, 23, 31, 3, 7, 33, 3, 3
Offset: 1

Author

Andres Cicuttin, May 27 2023

Keywords

Comments

The conjectured formula below suggests that as the value of n increases, the proportion of terms in the Farey sequence F_n that align with the #F_n rationals, evenly distributed between 0 and 1, tends to decrease.

Examples

			For n = 5, we have the Farey sequence F_5 = {0, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1} with 11 terms, and the corresponding sequence S_5 = {0, 1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, 9/10, 1} consisting of the 11 equidistant fractions {x/10} with 0 <= x <= 10. Since there are 5 fractions (0, 2/5, 1/2, 3/5, 1) in the same positions in both sequences, F_5 and S_5, then a(5) = 5.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:= Module[{len, fn, sn},
    fn = FareySequence[n];
    len = Length[fn];
    sn = Range[0, len - 1]/(len - 1);
    Count[fn - sn, 0]];
    Table[a[j], {j, 1, 80}]

Formula

Conjecture: lim_{n->infinity} a(n)/A005728(n) = 0.

A363300 Number of fractions of the Farey sequence of order n, F_n, that can be expressed as x/y, where y = #{F_n} - 1.

Original entry on oeis.org

2, 3, 3, 5, 7, 9, 7, 3, 11, 9, 13, 3, 3, 9, 23, 25, 25, 23, 33, 17, 33, 23, 5, 49, 45, 5, 33, 23, 53, 3, 49, 43, 9, 69, 49, 77, 75, 63, 7, 47, 11, 3, 9, 5, 5, 55, 53, 9, 55, 61, 57, 11, 97, 133, 67, 5, 81, 5, 7, 95, 15, 9, 5, 217, 13, 17, 75, 107, 133, 19, 113, 5, 21, 85, 117, 5, 9, 121, 3, 3
Offset: 1

Author

Andres Cicuttin, May 26 2023

Keywords

Examples

			For n = 5, we have the Farey sequence F_5 = {0, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1} with 11 terms, and the corresponding sequence S_5 = {0, 1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, 9/10, 1} consisting of the 11 equidistant fractions {x/10} with 0 <= x <= 10. Since there are 7 fractions (0, 1/5, 2/5, 1/2, 3/5, 4/5, 1) common to both sequences, F_5 and S_5, then a(5) = 7.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:= Module[{len, fn, sn},
    fn = FareySequence[n];
    len = Length[fn];
    sn = Range[0, len - 1]/(len - 1);
    Intersection[fn, sn] // Length];
    Table[a[j], {j,1,80}]

A358200 Frequency ranking position of the ratio r(n) between consecutive prime gaps, among all previous ratios {r(i) : 2 < i < n, r(i) = (prime(i) - prime(i-1))/(prime(i-1) - prime(i-2))}. If the ratio r(n) is not among previous ratios, then a(n)=n.

Original entry on oeis.org

4, 2, 6, 1, 2, 1, 10, 11, 12, 13, 2, 1, 6, 6, 5, 7, 7, 2, 7, 5, 7, 25, 2, 1, 2, 1, 2, 31, 32, 4, 6, 35, 36, 6, 7, 6, 4, 7, 7, 12, 9, 2, 2, 47, 6, 5, 1, 2, 5, 4, 9, 55, 5, 4, 4, 7, 7, 1, 8, 63, 10, 1, 2, 14, 68, 69, 9, 2, 5, 14, 74, 4, 6, 5, 11, 1, 2, 81, 9, 9, 9, 8, 6, 4, 10, 1, 1, 2, 7, 6, 1, 2, 1, 3, 2, 99, 100, 6, 19, 16
Offset: 4

Author

Andres Cicuttin, Feb 22 2023

Keywords

Comments

Given all primes up to prime(n-1) with n > 3, if a(n) != n then a(n) is the number of attempts to find the prime(n) using to the following algorithm:
1) Calculate all previous consecutive prime-gaps ratios psr(n) = {r(i) : 2 < i < n, r(i) = (prime(i) - prime(i-1))/(prime(i-1) - prime(i-2))}.
2) Tally the elements {r(i)} and sort them according to their frequencies in descending order first, and then by their values in ascending order.
3) Check the primality of candidates q in the same order as the ratio (q - prime(n-1))/(prime(n-1) - prime(n-2)) appears in the ordered set obtained above.
In the first 2^17 primes the median of all consecutive prime-gaps ratios is 16 and there are 621 different ratios.
Conjectures:
1) a(n)=n or a(n) < x*n^y with x ~ 6 and y ~ 0.4 (verified for first 2^16 primes).
2) The sequence is unbounded. (Equivalent to conjecture in A001223 on Sep 29 2018.)
3) The relative frequencies (probabilities) of the consecutive prime-gap ratios approach constants as the length of the list of first primes approaches infinity. (Equivalent to conjecture in A001223 on Sep 01 2019.)

Examples

			In the table below for the first terms, the columns are: index n, primes(n), consecutive prime-gaps ratio r(n), previous sorted ratios psr(n), and a(n).
   n  prime(n)  r(n)  psr(n)                        a(n)
   1    2       -     {}                             -
   2    3       -     {}                             -
   3    5       2     {}                             -
   4    7       1     {2}                            4
   5   11       2     {1, 2}                         2
   6   13       1/2   {2, 1}                         6
   7   17       2     {2, 1/2, 1}                    1
   8   19       1/2   {2, 1/2, 1}                    2
   9   23       2     {2, 1/2, 1}                    1
  10   29       3/2   {2, 1/2, 1}                    10
  11   31       1/3   {2, 1/2, 1, 3/2}               11
  12   37       3     {2, 1/2, 1/3, 1, 3/2}          12
  13   41       2/3   {2, 1/2, 1/3, 1, 3/2, 3}       13
  14   43       1/2   {2, 1/2, 1/3, 2/3, 1, 3/2, 3}  2
a(4), a(6), a(10), a(11), a(12) and a(13) are respectively 4, 6, 10, 11, 12 and 13 because the corresponding ratios 1, 1/2, 3/2, 1/3, 3 and 2/3 are ratios that appear for the first time.
a(5) = 2 because the corresponding ratio r(5)=2 is at the second position in the ordered set of previous ratios psr(5)={1, 2}.
a(9) = 1 because the corresponding ratio r(9)=2 is at the first position in the ordered set of previous ratios psr(7)={2, 1/2, 1}.
		

Crossrefs

Cf. A001223 (Prime gaps), A275785, A276812, A272863, A274225.

Programs

  • Mathematica
    p[n_]:= Prime[n];
    (* consecutive prime-gaps ratio *)
    r[n_]:= (p[n] - p[n - 1])/(p[n - 1] - p[n - 2]);
    (* sorted ratios according to increasing frequency and decreasing value *)
    fracs[n_]:= Transpose[SortBy[Tally[r[Range[3, n]]], {-#[[2]] &, #[[1]] &}]][[1]];
    SetAttributes[fracs, Listable];
    (* Position of the new ratio r[j] in previous list, or j if not present *)
    a[j_] := Append[Position[fracs[j - 1], r[j]], {j}] // First // First;
    SetAttributes[a, Listable];
    (* First 100 terms starting from n=4 *)
    a[Range[4,103]]

A359354 Position of the first subsequence of n primes that differs from the first n primes, but where the relative distances among their elements coincide with those of the subsequence of first n primes except for a scale factor.

Original entry on oeis.org

2, 2, 3, 238, 28495, 576169, 24635028
Offset: 1

Author

Andres Cicuttin, Dec 27 2022

Keywords

Comments

The first subsequence composed of one prime is {2}, whose unique element has zero distance with itself, and the same happens with the first subsequence of one element {3} that differs from {2}. As these distances are equal to zero they coincide, so a(1) = 2 because subsequence {3} is at position 2 in the sequence of primes.

Examples

			The first subsequence composed of two primes is {2,3}; the distance between its elements is 1. The subsequence of two primes {3,5} is the first subsequence that differs from {2,3}, and the distance between its elements is 2, a distance that coincides with 1 with a scale factor of 1/2, so a(2) = 2 because the first prime in the subsequence {3,5} is the 2nd prime.
The first subsequence composed of three primes is {2,3,5}; the distances between its consecutive elements are (1,2). The first subsequence of three primes {5,7,11} differs from {2,3,5} and the distances between its consecutive elements are (2,4), and these distances coincide with (1,2) with a scale factor of 1/2, so a(3) = 3 because the first prime in the subsequence {5,7,11} is the 3rd prime.
		

Crossrefs

Programs

  • Mathematica
    g[m_] := (Prime[m + 2] - Prime[m + 1])/(Prime[m + 1] - Prime[m]);
    gs[n_] := g[Range[n]];
    nmax = 2^26; (* maximum explorative range to obtain the first elements *)
    seqtot = gs[nmax];
    maxn = 5; (* Number of elements to look for after first two elements {2,2} *)
    {2,2}~Join~Table[SequencePosition[seqtot, gs[j]][[2]][[1]], {j, 1, maxn}]

A359357 Number of different ratios between consecutive prime gaps among the first n primes.

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 10, 10, 10, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19
Offset: 3

Author

Andres Cicuttin, Dec 27 2022

Keywords

Comments

What about the asymptotic behavior of a(n), and upper and lower bounds?

Crossrefs

Programs

  • Maple
    P:= [seq(ithprime(i),i=1..102)]:
    G:= P[2..-1]-P[1..-2]:
    R:= G[2..-1] /~ G[1..-2]:
    seq(nops(convert(R[1..n],set)),n=1..100); # Robert Israel, Jan 25 2023
  • Mathematica
    g[m_]:=(Prime[m+2]-Prime[m+1])/(Prime[m+1]-Prime[m]);
    Table[Tally[g[Range[j]]]//Length,{j,1,2^7}]
  • PARI
    f(n) = (prime(n+2)-prime(n+1))/(prime(n+1)-prime(n)); \\ A274263
    a(n) = #Set(vector(n, k, f(k))); \\ Michel Marcus, Dec 28 2022

Formula

a(n) = #{A001223(i+1)/A001223(i)}, i < n-1, where A001223 are prime gaps.