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

A255313 Triangle read by rows: row n contains the sums of adjacent pairs of terms in row n of A088643.

Original entry on oeis.org

3, 5, 3, 7, 5, 3, 7, 5, 7, 5, 11, 7, 5, 7, 5, 13, 11, 7, 5, 7, 5, 13, 11, 13, 11, 7, 5, 3, 17, 13, 11, 13, 11, 7, 5, 3, 19, 17, 13, 11, 13, 11, 7, 5, 3, 19, 17, 19, 17, 13, 11, 7, 5, 7, 5, 23, 19, 17, 19, 17, 13, 11, 7, 5, 7, 5, 23, 19, 17, 19, 23, 19, 13
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 22 2015

Keywords

Comments

All terms are prime by definition of A088643.
See A255313 for sorted distinct terms and A255395 for number of distinct terms.

Examples

			.  n |                  T(n,k)                    |       A255316
. ---+--------------------------------------------+----------------------
.  1 |  3                                         | 3
.  2 |  5  3                                      | 3 5
.  3 |  7  5  3                                   | 3 5  7
.  4 |  7  5  7  5                                | 5 7
.  5 | 11  7  5  7  5                             | 5 7 11
.  6 | 13 11  7  5  7  5                          | 5 7 11 13
.  7 | 13 11 13 11  7  5  3                       | 3 5  7 11 13
.  8 | 17 13 11 13 11  7  5  3                    | 3 5  7 11 13 17
.  9 | 19 17 13 11 13 11  7  5  3                 | 3 5  7 11 13 17 19
. 10 | 19 17 19 17 13 11  7  5  7  5              | 5 7 11 13 17 19
. 11 | 23 19 17 19 17 13 11  7  5  7  5           | 5 7 11 13 17 19 23
. 12 | 23 19 17 19 23 19 13 11  7  5  7  5        | 5 7 11 13 17 19 23
. 13 | 23 19 23 19 17 23 19 11  7 11 13  7  3     | 3 7 11 13 17 19 23
. 14 | 29 23 19 23 19 17 23 19 11  7 11 13  7  3  | 3 7 11 13 17 19 23 29
		

Crossrefs

Programs

  • Haskell
    a255313 n k = a255313_tabl !! (n-1) !! (k-1)
    a255313_row n = a255313_tabl !! (n-1)
    a255313_tabl = zipWith (zipWith (+)) tss $ map tail tss
                   where tss = tail a088643_tabl
  • Mathematica
    (* A is A088643 *)
    A[n_, 1] := n;
    A[n_, k_] := A[n, k] = For[m = n-1, m >= 1, m--, If[PrimeQ[m + A[n, k-1]] && FreeQ[Table[A[n, j], {j, 1, k-1}], m], Return[m]]];
    T[n_] := T[n] = 2 MovingAverage[Table[A[n+1, k], {k, 1, n+1}], {1, 1}];
    Array[T, 14] // Flatten (* Jean-François Alcover, Aug 02 2021 *)

Formula

T(n,k) = A088643(n,k-1) + A088643(n,k), 1 <= k <= n;
T(n,1) = A060265(n+1);

A346778 Least k >= 1 such that {b(1), b(2), ..., b(k)} = {n, n-1, ..., n-k+1} and b(k+1) = n-k where b(1..n) is row n of A088643, or k = 0 if no such k >= 1 exists.

Original entry on oeis.org

0, 1, 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 6, 12, 1, 1, 4, 6, 1, 8, 1, 1, 4, 1, 6, 22, 1, 9, 10, 1, 1, 4, 6, 1, 8, 1, 1, 4, 6, 1, 8, 1, 18, 9, 1, 9, 10, 16, 1, 18, 1, 1, 4, 1, 1, 4, 1, 6, 12, 11, 27, 14, 62, 1, 17, 1, 18, 18, 1, 1, 4, 6, 8, 10, 1, 1, 4, 6, 1, 8, 19
Offset: 1

Views

Author

Sean A. Irvine, Aug 03 2021

Keywords

Comments

Equivalently, least k such that {b(1), b(2), ..., b(k)} = {n, n-1, ..., n-k+1} and {b(1), b(2), ..., b(k), b(k+1)} = {n, n-1, ..., n-k+1, n-k}.
Since any row n of A088643 is a permutation of [1..n] having 1 as last term (conjectured), one always has a(n) <= n - 1. - M. F. Hasler, Aug 04 2021

Crossrefs

Programs

  • Mathematica
    (* t is A088643 *)
    t[n_, 1] := n;
    t[n_, k_] := t[n, k] = For[m = n-1, m >= 1, m--, If[PrimeQ[m + t[n, k-1]] && FreeQ[Table[t[n, j], {j, 1, k-1}], m], Return[m]]];
    a[n_] := If[n == 1, 0, Module[{r, g}, r = Table[t[n, k], {k, 1, n}]; For[g = 1, g <= n-1, g++, If[Union@r[[1 ;; g]] == Range[n-g+1, n] && r[[g+1]] == n-g, Return[g]]]]];
    Table[a[n], {n, 1, 400}] (* Jean-François Alcover, Aug 11 2022, after M. F. Hasler *)
  • PARI
    apply( {A346778(n, r=A088643_row(n))=for(g=1, n-1, Set(r[1..g])==[n-g+1..n] && r[g+1]==n-g && return(g))}, [1..99]) \\ M. F. Hasler, Aug 04 2021

Extensions

Definition corrected by M. F. Hasler, Aug 03 2021

A049477 For each record-breaking row, m, of A088643, the sequence gives the length, k, of the longest earlier row contained in row m.

Original entry on oeis.org

1, 1, 1, 7, 2, 4, 34, 1, 47, 47, 47, 47, 47, 47, 47, 153, 212, 212, 212, 212, 212, 212, 212, 334, 334, 785, 785, 720, 785, 785, 785, 785, 785, 1144, 1144, 1144, 1167, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105
Offset: 1

Views

Author

Keywords

Comments

A record-breaking row, m, of A088643, is a row where m-k sets a record.
a(n) = A049476(n) - A049478(n).

Crossrefs

Extensions

Entry revised by Editors of OEIS, Aug 03 2021

A255312 Positive integers m for which the m-th row of A088643 in reverse agrees with the first m terms of A132075.

Original entry on oeis.org

1, 2, 3, 4, 26, 27, 35, 36, 37, 47, 153, 206, 254, 255, 267, 326, 334, 543, 544, 550, 573, 590, 604, 719, 720, 965, 1327, 1340, 1353, 1354, 1414, 1423, 1453, 1474, 1579, 1589, 1598, 1762, 1856, 2105, 2840, 2921, 2922, 2928
Offset: 1

Views

Author

Paul Boddington, Feb 20 2015

Keywords

Comments

I do not know if this sequence is infinite. Given any term it is easy to compute all earlier terms. The largest number I know of in the sequence is 21977.

Crossrefs

A088861 Third column of triangle in A088643.

Original entry on oeis.org

1, 2, 3, 2, 5, 6, 5, 8, 9, 8, 9, 10, 9, 14, 15, 16, 13, 14, 17, 20, 21, 20, 21, 22, 21, 22, 23, 24, 29, 30, 31, 28, 29, 32, 35, 36, 37, 34, 35, 38, 39, 40, 39, 40, 41, 42, 41, 42, 47, 50, 51, 50, 53, 54, 53, 54, 55, 56, 57, 58, 59, 50, 51, 62, 63, 64, 63, 68, 69, 70, 71, 72, 65
Offset: 1

Views

Author

N. J. A. Sloane, Nov 26 2003

Keywords

Crossrefs

Cf. A088643. A088631 gives second column.

Extensions

More terms from John W. Layman, Dec 04 2003

A055265 a(n) is the smallest positive integer not already in the sequence such that a(n)+a(n-1) is prime, starting with a(1)=1.

Original entry on oeis.org

1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 13, 16, 15, 14, 17, 12, 11, 18, 19, 22, 21, 20, 23, 24, 29, 30, 31, 28, 25, 34, 27, 26, 33, 38, 35, 32, 39, 40, 43, 36, 37, 42, 41, 48, 49, 52, 45, 44, 53, 50, 47, 54, 55, 46, 51, 56, 57, 70, 61, 66, 65, 62, 69, 58, 73, 64, 63, 68, 59, 72, 67, 60
Offset: 1

Views

Author

Henry Bottomley, May 09 2000

Keywords

Comments

The sequence is well-defined (the terms must alternate in parity, and by Dirichlet's theorem a(n+1) always exists). - N. J. A. Sloane, Mar 07 2017
Does every positive integer eventually occur? - Dmitry Kamenetsky, May 27 2009. Reply from Robert G. Wilson v, May 27 2009: The answer is almost certainly yes, on probabilistic grounds.
It appears that this is the limit of the rows of A051237. That those rows do approach a limit seems certain, and given that that limit exists, that this sequence is the limit seems even more likely, but no proof is known for either conjecture. - Robert G. Wilson v, Mar 11 2011, edited by Franklin T. Adams-Watters, Mar 17 2011
The sequence is also a particular case of "among the pairwise sums of any M consecutive terms, N are prime", with M = 2, N = 1. For other M, N see A055266 & A253074 (M = 2, N = 0), A329333, A329405 - A329416, A329449 - A329456, A329563 - A329581, and the OEIS Wiki page. - M. F. Hasler, Feb 11 2020

Examples

			a(5) = 7 because 1, 2, 3 and 4 have already been used and neither 4 + 5 = 9 nor 4 + 6 = 10 are prime while 4 + 7 = 11 is prime.
		

Crossrefs

Inverse permutation: A117922; fixed points: A117925; A117923=a(a(n)). - Reinhard Zumkeller, Apr 03 2006
Cf. A086527 (the primes a(n)+a(n-1)).
Cf. A070942 (n's such that a(1..n) is a permutation of (1..n)). - Zak Seidov, Oct 19 2011
See also A076990, A243625.
See A282695 for deviation from identity sequence.
A073659 is a version where the partial sums must be primes.

Programs

  • Haskell
    import Data.List (delete)
    a055265 n = a055265_list !! (n-1)
    a055265_list = 1 : f 1 [2..] where
       f x vs = g vs where
         g (w:ws) = if a010051 (x + w) == 1
                       then w : f w (delete w vs) else g ws
    -- Reinhard Zumkeller, Feb 14 2013
    
  • Maple
    A055265 := proc(n)
        local a,i,known ;
        option remember;
        if n =1 then
            1;
        else
            for a from 1 do
                known := false;
                for i from 1 to n-1 do
                    if procname(i) = a then
                        known := true;
                        break;
                    end if;
                end do:
                if not known and isprime(procname(n-1)+a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A055265(n),n=1..100) ; # R. J. Mathar, Feb 25 2017
  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[ -1]]}, While[ MemberQ[s, k] || ! PrimeQ[a + k], k++ ]; Append[s, k]]; Nest[f, {1}, 71] (* Robert G. Wilson v, May 27 2009 *)
    q=2000; a={1}; z=Range[2,2*q]; While[Length[z]>q-1, k=1; While[!PrimeQ[z[[k]]+Last[a]], k++]; AppendTo[a,z[[k]]]; z=Delete[z,k]]; Print[a] (*200 times faster*) (* Vladimir Joseph Stephan Orlovsky, May 03 2011 *)
  • PARI
    v=[1];n=1;while(n<50,if(isprime(v[#v]+n)&&!vecsearch(vecsort(v),n), v=concat(v,n);n=0);n++);v \\ Derek Orr, Jun 01 2015
    
  • PARI
    U=-a=1; vector(100,k, k=valuation(1+U+=1<M. F. Hasler, Feb 11 2020

Formula

a(2n-1) = A128280(2n-1) - 1, a(2n) = A128280(2n) + 1, for all n >= 1. - M. F. Hasler, Feb 11 2020

Extensions

Corrected by Hans Havermann, Sep 24 2002

A051252 Number of essentially different ways of arranging numbers 1 through 2n around a circle so that sum of each pair of adjacent numbers is prime.

Original entry on oeis.org

1, 1, 1, 2, 48, 512, 1440, 40512, 385072, 3154650, 106906168, 3197817022, 82924866213, 4025168862425, 127854811616691
Offset: 1

Views

Author

Keywords

Comments

Jud McCranie reports that he was able to find a solution for each n <= 225 (2n <= 450) in just a few seconds. - Jul 05 2002
Is there a proof that this can always be done?
The Mathematica program for this sequence uses backtracking to find all solutions for a given n. To verify that at least one solution exists for a given n, the backtracking function be made to stop when the first solution is found. Solutions have been found for n <= 48. - T. D. Noe, Jun 19 2002
This sequence is from the prime circle problem. There is no known proof that a(n) > 0 for all n. However, for many n (see A072618 and A072676), we can prove that a(n) > 0. Also, the sequence A072616 seems to imply that there are always solutions in which the odd (or even) numbers are in order around the circle. - T. D. Noe, Jul 01 2002
Prime circles can apparently be generated for any n using the Mathematica programs given in A072676 and A072184. - T. D. Noe, Jul 08 2002
The following seems to always produce a solution: Work around the circle starting with 1 but after that always choosing the largest remaining number that fits. For example, if n = 4 this gives 1, 6, 7, 4, 3, 8, 5, 2. See A088643 for a sequence on a related idea. - Paul Boddington, Oct 30 2007
See A228917 for a similar conjecture on twin primes. - Zhi-Wei Sun, Sep 08 2013
See A242527 for a similar problem on the set of numbers {0 through (n-1)}. - Stanislav Sykora, May 30 2014
James Tilley and Stan Wagon report that all terms up to n = 10^6 are nonzero. Charles R Greathouse IV, Feb 05 2016

Examples

			One arrangement for 2n=6 is 1,4,3,2,5,6 and this is essentially unique, so a(3)=1.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, second edition, Springer, 1994. See section C1.

Crossrefs

Programs

  • Mathematica
    $RecursionLimit=500; try[lev_] := Module[{t, j}, If[lev>2n, (*then make sure the sum of the first and last is prime*) If[PrimeQ[soln[[1]]+soln[[2n]]]&&soln[[2]]<=soln[[2n]], (*Print[soln]; *) cnt++ ], (*else append another number to the soln list*) t=soln[[lev-1]]; For[j=1, j<=Length[s[[t]]], j++, If[ !MemberQ[soln, s[[t]][[j]]], soln[[lev]]=s[[t]][[j]]; try[lev+1]; soln[[lev]]=0]]]]; For[lst={}; n=1, n<=7, n++, s=Table[{}, {2n}]; For[i=1, i<=2n, i++, For[j=1, j<=2n, j++, If[i!=j&&PrimeQ[i+j], AppendTo[s[[i]], j]]]]; soln=Table[0, {2n}]; soln[[1]]=1; cnt=0; try[2]; AppendTo[lst, cnt]]; lst (* T. D. Noe *)

Extensions

a(14)-a(15) from Max Alekseyev, Sep 19 2013

A255316 Distinct terms in triangle A255313, table read by rows.

Original entry on oeis.org

3, 3, 5, 3, 5, 7, 5, 7, 5, 7, 11, 5, 7, 11, 13, 3, 5, 7, 11, 13, 3, 5, 7, 11, 13, 17, 3, 5, 7, 11, 13, 17, 19, 5, 7, 11, 13, 17, 19, 5, 7, 11, 13, 17, 19, 23, 5, 7, 11, 13, 17, 19, 23, 3, 7, 11, 13, 17, 19, 23, 3, 7, 11, 13, 17, 19, 23, 29, 3, 7, 11, 13, 17
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 22 2015

Keywords

Examples

			See A255313.
		

Crossrefs

Cf. A255313, A255395 (row lengths), A255427 (row products).

Programs

  • Haskell
    import Data.List (nub, sort)
    a255316 n k = a255316_tabf !! (n-1) !! (k-1)
    a255316_row n = a255316_tabf !! (n-1)
    a255316_tabf = map (sort . nub) a255313_tabl
  • Mathematica
    (* A is A088643 *)
    A[n_, 1] := n;
    A[n_, k_] := A[n, k] = For[m = n - 1, m >= 1, m--,
         If[PrimeQ[m + A[n, k - 1]] &&
         FreeQ[Table[A[n, j], {j, 1, k - 1}], m], Return[m]]];
    T[n_] := T[n] = Union[2 MovingAverage[
         Table[A[n+1, k], {k, 1, n+1}], {1, 1}]];
    Array[T, 20] // Flatten (* Jean-François Alcover, Aug 02 2021 *)

A088631 Largest number m < n such that m+n is a prime.

Original entry on oeis.org

1, 2, 3, 2, 5, 6, 5, 8, 9, 8, 11, 10, 9, 14, 15, 14, 13, 18, 17, 20, 21, 20, 23, 22, 21, 26, 25, 24, 29, 30, 29, 28, 33, 32, 35, 36, 35, 34, 39, 38, 41, 40, 39, 44, 43, 42, 41, 48, 47, 50, 51, 50, 53, 54, 53, 56, 55, 54, 53, 52, 51, 50, 63, 62, 65, 64, 63, 68, 69, 68, 67, 66, 65, 74, 75
Offset: 2

Views

Author

N. J. A. Sloane, Nov 24 2003

Keywords

Examples

			Adding 1,2,3,2,5 to 2,3,4,5,6 we get the primes 3,5,7,7,11.
		

Crossrefs

Cf. A088633. Second column of A088643.

Programs

  • Haskell
    a088631 n = a060265 n - n  -- Reinhard Zumkeller, Feb 22 2015
  • Maple
    with(numtheory); A088631 := n->prevprime(2*n)-n;

Formula

a(n) = p-n where p = largest prime <= 2n-1.
a(n) = A060265(n) - n. - Reinhard Zumkeller, Feb 22 2015

A049476 Positions of records in A346778.

Original entry on oeis.org

1, 2, 5, 13, 14, 26, 61, 63, 111, 131, 151, 153, 155, 161, 179, 295, 390, 391, 398, 425, 428, 459, 485, 656, 675, 1142, 1143, 1169, 1243, 1247, 1255, 1263, 1267, 1639, 1643, 1646, 1748, 2690, 2702, 2703, 2728, 2767, 2777, 2786, 2840, 2877
Offset: 1

Views

Author

Keywords

Comments

Previous name: Row numbers that set records for initial gap lengths g in the permutations found in A088643.

Examples

			For n = 4, when we examine row 13 in A088643, the Roche algorithm produces the initial row values 13, 10, 9, 8, 11, 12. The remaining values are equal to row 7 in A088643, and at no earlier point in row 13 are the remaining values equal to row m, 7 < m < 13. So we calculate the difference between 13 and 7 ("the uncharted length") to be 6, which is longer than the previous record uncharted length (A049478(3) = 4) set by row a(3) = 5. So a(4) = 13. - _Peter Munn_, Aug 03 2021 (based on text supplied by _J. Stauduhar_)
		

Crossrefs

Programs

  • PARI
    {print1(m=0); for( n=1, oo, my( r=A088643_row(n)); for( g=1, #r-1, if( Set(r[1..g]) == [n-g+1..n] && r[g+1]==n-g, g > m && print1(","n)+ m=g; break)))} \\ M. F. Hasler, Aug 04 2021

Extensions

Revised by Sean A. Irvine, Aug 03 2021
Showing 1-10 of 13 results. Next