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

A185645 Number of permutations q_1,...,q_n of the first n primes p_1,...,p_n with q_1 = p_1 = 2 and q_n = p_n, and with |q_1-q_2|, |q_2-q_3|, ..., |q_{n-1}-q_n|, and |q_n-q_1| (if n>2) pairwise distinct.

Original entry on oeis.org

1, 1, 1, 1, 3, 5, 10, 33, 153, 1060, 7337, 51434, 440728, 3587067, 28498105, 271208386, 3014400869, 35358507494
Offset: 1

Views

Author

Zhi-Wei Sun, Aug 29 2013

Keywords

Comments

Conjecture: a(n) > 0 for all n > 0. In general, for any n consecutive primes p_k,...,p_{k+n-1}, there always exists a permutation q_k,...,q_{k+n-1} of p_k,...,p_{k+n-1} with q_{k+n-1} = p_{k+n-1} such that the n-1 numbers |q_k-q_{k+1}|, |q_{k+1}-q_{k+2}|,...,|q_{k+n-2}-q_{k+n-1}| are pairwise distinct. (In the case k = 2, this implies that a(n) > 0.)
Clearly there is no permutation a,b,c of 3,5,7 such that the three numbers |a-b|,|b-c|,|c-a| are pairwise distinct. Also, for {a,b} = {7,11}, the three numbers |5-a|,|a-b|,|b-13| cannot be pairwise distinct.
On Aug 31 2013, Zhi-Wei Sun proved the following extension of the general conjecture: Let a_1 < a_2 < ... < a_n be a sequence of n distinct real numbers in ascending order. Then there is a permutation b_1, ..., b_n of a_1, ..., a_n with b_n = a_n such that |b_1-b_2|, |b_2-b_3|, ..., |b_{n-1}-b_n| are pairwise distinct. In fact, when n = 2*k is even we may take (b_1,...,b_n) = (a_k,a_{k+1},a_{k-1},a_{k+2},...,a_2,a_{2k-1},a_1,a_{2k}); when n = 2*k-1 is odd we may take (b_1,...,b_n) = (a_k,a_{k-1},a_{k+1},a_{k-2},a_{k+2},..., a_2,a_{2k-2},a_1,a_{2k-1}).
On Sep 01 2013, Zhi-Wei Sun made the following conjecture: (i) For any n distinct real numbers a_1, a_2, ..., a_n (not necessarily in ascending or descending order), there is a permutation b_1, ..., b_n of a_1, ..., a_n with b_1 = a_1 such that the n-1 distances |b_1-b_2|, |b_2-b_3|, ..., |b_{n-1}-b_n| are pairwise distinct.
(ii) Let a_1, ..., a_n be n distinct elements of a finite additive abelian group G. Suppose that |G| is not divisible by n, or n is even and G is cyclic. Then there exists a permutation b_1, ..., b_n of a_1, ..., a_n with b_1 = a_1 such that the n-1 differences b_{i+1}-b_i (i = 1, ..., n-1) are pairwise distinct.
We believe that part (ii) of the new conjecture holds at least when G is cyclic, and it might also hold when the group G is not abelian.
Note that if g is a primitive root modulo an odd prime p, then for any j = 0,...,p-2 the permutation g^j, g^{j+1},...,g^{j+p-2} of the p-1 nonzero residues modulo p has adjacent differences g^{i+j+1}-g^{i+j} = g^{i+j}*(g-1) (i = 0, ..., p-3) which are pairwise distinct modulo p.

Examples

			a(4) = 1 since (q_1,q_2,q_3,q_4) = (2,5,3,7) is the only suitable permutation.
a(5) = 3 since there are exactly three suitable permutations(q_1,q_2,q_3,q_4,q_5): (2,3,7,5,11), (2,5,7,3,11) and (2,7,3,5,11).
a(6) = 5 since there are exactly five suitable permutations (q_1,q_2,q_3,q_4,q_5,q_6): (2,5,3,11,7,13), (2,5,7,11,3,13), (2,7,5,11,3,13), (2,7,11,5,3,13), (2,11,5,7,3,13).
a(7) = 10, and the ten suitable permutations (q_1,...,q_7) are as follows:
  (2,3,13,5,7,11,17), (2,7,3,13,11,5,17), (2,7,5,11,3,13,17),
  (2,7,11,5,13,3,17), (2,11,3,13,7,5,17), (2,11,7,5,13,3,17),
  (2,11,7,13,3,5,17), (2,11,7,13,5,3,17), (2,13,3,11,7,5,17),
  (2,13,7,11,3,5,17).
		

Crossrefs

Programs

  • Mathematica
    A185645[n_] := Module[{p, c = 0, i = 1, j, q},
       If[n == 2, Return[1],
       p = Permutations[Table[Prime[j], {j, 2, n - 1}]];
       While[i <= Length[p],
        q = Join[{2}, p[[i]], {Prime[n]}]; i++;
        If[Length[Union[Join[Table[Abs[q[[j]] - q[[j + 1]]], {j, 1, n - 1}], {Abs[q[[n]] - q[[1]]]}]]] == n, c++]]; c]];
    Table[A185645[n], {n, 1, 11}]  (* Robert Price, Apr 04 2019 *)

Extensions

Name clarified by Robert Price, Apr 04 2019
a(12)-a(18) from Bert Dobbelaere, Sep 08 2019

A228917 Number of undirected circular permutations i_0, i_1, ..., i_n of 0, 1, ..., n such that i_0+i_1, i_1+i_2, ...,i_{n-1}+i_n, i_n+i_0 are among those k with 6*k-1 and 6*k+1 twin primes.

Original entry on oeis.org

1, 1, 1, 2, 2, 2, 5, 2, 12, 39, 98, 526, 2117, 6663, 15043, 68403, 791581, 4826577, 19592777, 102551299, 739788968, 4449585790, 36547266589, 324446266072, 2743681178070
Offset: 1

Views

Author

Zhi-Wei Sun, Sep 08 2013

Keywords

Comments

Conjecture: a(n) > 0 for all n > 0.
This implies the twin prime conjecture, and it is similar to the prime circle problem mentioned in A051252.
For each n = 2,3,... construct an undirected simple graph T(n) with vertices 0,1,...,n which has an edge connecting two distinct vertices i and j if and only if 6*(i+j)-1 and 6*(i+j)+1 are twin primes. Then a(n) is just the number of Hamiltonian cycles contained in T(n). Thus a(n) > 0 if and only if T(n) is a Hamilton graph.
Zhi-Wei Sun also made the following similar conjectures for odd primes, Sophie Germain primes, cousin primes and sexy primes:
(1) For any integer n > 0, there is a permutation i_0, i_1, ..., i_n of 0, 1, ..., n such that i_0+i_1, i_1+i_2, ..., i_{n-1}+i_n, i_n+i_0 are integers of the form (p-1)/2, where p is an odd prime. Also, we may replace the above (p-1)/2 by (p+1)/4 or (p-1)/6; when n > 4 we may substitute (p-1)/4 for (p-1)/2.
(2) For any integer n > 2, there is a permutation i_0, i_1, ..., i_n of 0, 1,..., n such that i_0+i_1, i_1+i_2, ..., i_{n-1}+i_n, i_n+i_0 are integers of the form (p+1)/6, where p is a Sophie Germain prime.
(3) For any integer n > 3, there is a permutation i_0, i_1, ..., i_n of 0, 1,..., n such that i_0+i_1, i_1+i_2, ..., i_{n-1}+i_n, i_n+i_0 are among those integers k with 6*k+1 and 6*k+5 both prime.
(4) For any integer n > 4, there is a permutation i_0, i_1, ..., i_n of 0, 1,..., n such that i_0+i_1, i_1+i_2, ..., i_{n-1}+i_n, i_n+i_0 are among those integers k with 2*k-3 and 2*k+3 both prime.

Examples

			a(n) = 1 for n = 1,2,3 due to the permutation (0,...,n).
a(4) = 2 due to the permutations (0,1,4,3,2) and (0,2,1,4,3).
a(5) = 2 due to the permutations (0,1,4,3,2,5), (0,3,4,1,2,5).
a(6) = 2 due to the permutations
  (0,1,6,4,3,2,5) and (0,3,4,6,1,2,5).
a(7) = 5 due to the permutations
  (0,1,6,4,3,2,5,7), (0,1,6,4,3,7,5,2), (0,2,1,6,4,3,7,5),
  (0,3,4,6,1,2,5,7), (0,5,2,1,6,4,3,7).
a(8) = 2 due to the permutations
  (0,1,6,4,8,2,3,7,5) and (0,1,6,4,8,2,5,7,3).
a(9) = 12 due to the permutations
  (0,1,6,4,3,9,8,2,5,7), (0,1,6,4,8,9,3,2,5,7),
  (0,1,6,4,8,9,3,7,5,2), (0,2,1,6,4,8,9,3,7,5),
  (0,2,8,9,1,6,4,3,7,5), (0,3,4,6,1,9,8,2,5,7),
  (0,3,9,1,6,4,8,2,5,7), (0,3,9,8,4,6,1,2,5,7),
  (0,5,2,1,6,4,8,9,3,7), (0,5,2,8,4,6,1,9,3,7),
  (0,5,2,8,9,1,6,4,3,7), (0,5,7,3,9,1,6,4,8,2).
a(10) > 0 due to the permutation (0,5,2,3,9,1,6,4,8,10,7).
a(11) > 0 due to the permutation (0,10,8,9,3,7,11,6,4,1,2,5).
a(12) > 0 due to the permutation
        (0, 5, 2, 1, 6, 4, 3, 9, 8, 10, 7, 11, 12).
		

Crossrefs

Programs

  • Mathematica
    (* A program to compute required circular permutations for n = 7. To get "undirected" circular permutations, we should identify a circular permutation with the one of the opposite direction; for example, (0,7,5,2,3,4,6,1) is identical to (0,1,6,4,3,2,5,7) if we ignore direction. Thus a(7) is half of the number of circular permutations yielded by this program. *)
    tp[n_]:=tp[n]=PrimeQ[6n-1]&&PrimeQ[6n+1]
    V[i_]:=Part[Permutations[{1,2,3,4,5,6,7}],i]
    m=0
    Do[Do[If[tp[If[j==0,0,Part[V[i],j]]+If[j<7,Part[V[i],j+1],0]]==False,Goto[aa]],{j,0,7}];
    m=m+1;Print[m,":"," ",0," ",Part[V[i],1]," ",Part[V[i],2]," ",Part[V[i],3]," ",Part[V[i],4]," ",Part[V[i],5]," ",Part[V[i],6]," ",Part[V[i],7]];Label[aa];Continue,{i,1,7!}]

Extensions

a(10)-a(25) from Max Alekseyev, Sep 12 2013

A228762 Number of undirected circular permutations i_1,...,i_{n-1} of 1,...,n-1 with i_1-i_2, ..., i_{n-2}-i_{n-1}, i_{n-1}-i_1 pairwise distinct modulo n.

Original entry on oeis.org

1, 0, 1, 0, 7, 0, 39, 0, 419, 0, 7208, 0, 226512, 0, 7885970, 0, 345718580, 0, 18478915794, 0
Offset: 3

Views

Author

Zhi-Wei Sun, Sep 03 2013

Keywords

Comments

If i_1,...,i_{n-1} is a permutation of 1,...,n-1 with i_1-i_2, ..., i_{n-2}-i_{n-1}, i_{n-1}-i_1 pairwise distinct modulo n, then 0 = (i_1-i_2)+...+(i_{n-1}-i_1) == 1+2+...+(n-1) = n(n-1)/2 (mod n) and hence n is odd. So a(n) = 0 for every n = 4,6,8,...
If g is a primitive root modulo an odd prime p, then 1-g, g-g^2, g^2-g^3, ..., g^{p-3}-g^{p-2},g^{p-2}-1 are pairwise distinct modulo p. Therefore a(p) > 0 for any odd prime p.
Conjecture: a(n) > 0 for any odd number n > 1. In general, if G is an additive abelian group with |G| = n odd and greater than one, then there is a permutation a_1,...,a_{n-1} of all the nonzero elements of G such that a_1-a_2, a_2-a_3, ..., a_{n-2}-a_{n-1}, a_{n-1}-a_1 are pairwise distinct.
For any integer n > 1, the author has showed that there is a permutation i_1, ..., i_n of 1, ..., n such that i_1-i_2, i_2-i_3, ..., i_{n-1}-i_n are pairwise distinct if and only if n is even.

Examples

			a(3) = 1 since the circular permutation (1,2) of 1,2 meets the requirement.
a(5) = 1 due to the circular permutation (1,2,4,3).
a(7) = 7 due to the following circular permutations:
  (1,2,5,4,6,3), (1,2,6,4,3,5), (1,3,2,5,6,4), (1,3,2,6,4,5),
  (1,3,4,2,6,5), (1,4,5,3,2,6), (1,5,4,2,3,6).
a(9) > 0 due to the circular permutation (1,2,5,3,7,6,8,4).
a(15) > 0 due to the circular permutation
  (1,3,14,7,4,11,5,10,9,12,13,2,8,6).
a(21) > 0 due to the circular permutation
  (1,2,11,8,19,15,9,4,10,3,6,13,18,7,5,17,16,20,12,14).
Permutations for n = 15, 21 were produced by Qing-Hu Hou at Nankai Univ. after the author told him the conjecture.
		

Crossrefs

Programs

  • Maple
    A228762 := proc(n)
        local a, pL,p,mset,per,i ;
        a := 0 ;
        pL := combinat[permute](n-2) ;
        for  p in pL do
            mset := {} ;
            per := [1,seq(op(i,p)+1,i=1..nops(p))] ;
            # only directed
            if op(2,per) <= op(-1,per) then
                for i from 1 to nops(per) do
                    if i = nops(per) then
                        mset := mset union { modp(n+op(i,per)-op(1,per),n) } ;
                    else
                        mset := mset union { modp(n+op(i,per)-op(i+1,per),n) } ;
                    end if;
                end do:
                if nops(mset) = n-1 then
                    a := a+1 ;
                end if;
            end if;
        end do:
        return a;
    end proc:
    for n from 3 do
        A228762(n) ;
    end do; # R. J. Mathar, Sep 03 2013
  • Mathematica
    A program to compute required circular permutations of 1,...,7 (beginning with 1). To get undirected circular permutations, we should identify one such a permutation with the one of the opposite direction; for example, (1,3,6,4,5,2) is identical to (1,2,5,4,6,3).
    V[i_]:=Part[Permutations[{2,3,4,5,6}],i]
    m=0
    Do[If[Length[Union[{Mod[1-Part[V[i],1],7]},Table[Mod[Part[V[i],j]-If[j<5,Part[V[i],j+1],1],7],{j,1,5}]]]<6,Goto[aa]];
    m=m+1;Print[m,":"," ",1," ",Part[V[i],1]," ",Part[V[i],2]," ",Part[V[i],3]," ",Part[V[i],4]," ",Part[V[i],5]];Label[aa];Continue,{i,1,5!}]

Extensions

a(9) and a(11) added by R. J. Mathar, Sep 03 2013
a(12)-a(22) from Robin Visser, Aug 26 2023

A228860 Number of permutations i_1,...,i_n of 1,...,n with i_1 = 1 and i_n = n, and with the n adjacent sums i_1+i_2, i_2+i_3, ..., i_{n-1}+i_n, i_n+i_1 all coprime to n.

Original entry on oeis.org

1, 1, 0, 1, 2, 1, 40, 36, 144, 78, 126336, 176, 14035200, 69480, 779436, 25401600, 465334732800, 1700352, 127064889262080, 1888106496, 1479065243520, 1774752094080, 18353630943019008000, 144127475712, 116009818818379776000, 30959322906758400, 373881853408444416000
Offset: 1

Views

Author

Zhi-Wei Sun, Sep 05 2013

Keywords

Comments

Conjecture: a(n) > 0 except for n = 3.
If n is a power of two, then a(n) > 0 since the identical permutation 1,2,3,...,n meets the requirement. For any prime p > 3, we have a(p) > 0 since the permutation 1,...,(p-1)/2, (p+3)/2,(p+1)/2,(p+5)/2,...,p meets our purpose.
Let G(n) be the undirected simple graph with vertices 1,...,n which has an edge connecting two distinct vertices i and j if and only if i + j is relatively prime to n. Then, for any n > 2, the number a(n) is just the number of those Hamiltonian cycles in G(n) on which the vertices 1 and n are adjacent.
Let m be any integer relatively prime to n, and let i_k be the smallest positive residue of k*m modulo n. Then i_1, i_2, ..., i_n is a permutation of 1, ..., n with the n adjacent differences i_1-i_2, i_2-i_3, ..., i_{n-1}-i_n, i_n-i_1 all coprime to n.
On Sep 06 2013, the author's two former PhD students Hui-Qin Cao (from Nanjing Audit Univ.) and Hao Pan (from Nanjing Univ.) proved the conjecture fully.

Examples

			a(4) = 1 due to the permutation 1,2,3,4.
a(5) = 2 due to the permutations 1,2,4,3,5 and 1,3,4,2,5.
a(6) = 1 due to the permutation 1,4,3,2,5,6.
a(7) > 0 due to the permutation 1,2,3,5,4,6,7.
a(8) > 0 due to the permutation 1,2,3,4,5,6,7,8.
a(9) > 0 due to the permutation 1,3,2,5,8,6,4,7,9.
a(10) > 0 due to the permutation 1,2,5,4,7,6,3,8,9,10.
a(11) > 0 due to the permutation 1,2,3,4,5,7,6,8,9,10,11.
a(12) > 0 due to the permutation 1,4,9,2,5,8,3,10,7,6,11,12.
		

Crossrefs

Programs

  • Mathematica
    (*A program to compute the required permutations for n = 9.*)
    V[i_]:=Part[Permutations[{2,3,4,5,6,7,8}],i]
    m=0
    Do[Do[If[GCD[If[j==0,1,Part[V[i],j]]+If[j<7,Part[V[i],j+1],9],9]>1,Goto[aa]],{j,0,7}];
    m=m+1;Print[m,":"," ",1," ",Part[V[i],1]," ",Part[V[i],2]," ",Part[V[i],3]," ",Part[V[i],4]," ",Part[V[i],5]," ",Part[V[i],6]," ",Part[V[i],7]," ",9];Label[aa];Continue,{i,1,7!}]

Extensions

a(12)-a(27) from Max Alekseyev, Sep 13 2013

A228772 Number of undirected circular permutations i_0,i_1,...,i_{n-1} of 0,1,...,n-1 such that i_0+i_1+i_2, i_1+i_2+i_3, ..., i_{n-3}+i_{n-2}+i_{n-1}, i_{n-2}+i_{n-1}+i_0, i_{n-1}+i_0+i_1 are pairwise distinct modulo n.

Original entry on oeis.org

0, 3, 2, 24, 24, 392, 513, 4080, 8090, 96816, 238296, 2023896, 7325520, 63277376, 277838352, 2185076682, 12898278126
Offset: 3

Views

Author

Zhi-Wei Sun, Sep 03 2013

Keywords

Comments

Note that if n > 3 is not a multiple of 3 then a(n) > 0 since the natural circular permutation (0,1,2,...,n-1) meets the requirement.
Conjecture: Let G be an additive abelian group. If G is cyclic or G contains no involution, then for any finite subset A of G with |A| = n > 3, there is a numbering a_1,...,a_n of the elements of A such that the n sums a_1+a+2+a_3, a_2+a_3+a_4, ..., a_{n-2}+a_{n-1}+a_n, a_{n-1}+a_n+a_1, a_n+a_1+a_2 are pairwise distinct.
On Sep 13 2013, the author proved the conjecture for any torsion-free abelian group G.

Examples

			a(4) = 3 due to the circular permutations (0,1,2,3), (0,1,3,2) and (0,2,1,3).
a(5) = 2 due to the circular permutations (0,1,2,3,4) and(0,2,4,1,3).
a(6) > 0 due to the circular permutation (0,1,2,4,5,3).
a(9) > 0 due to the circular permutation (0,1,2,3,8,5,6,7,4).
		

Crossrefs

Programs

  • Mathematica
    (* A program to compute required circular permutations for n = 9. To get "undirected" circular permutations, we should identify a circular permutation with the one of the opposite direction; for example, (0,4,7,6,5,8,3,2,1) is identical to (0,1,2,3,8,5,6,7,4) if we ignore direction.*)
    V[i_]:=Part[Permutations[{1,2,3,4,5,6,7,8}],i]
    m=0
    Do[If[Length[Union[Table[Mod[If[j==0,0,Part[V[i],j]]+If[j<8,Part[V[i],j+1],0]+If[j<7,Part[V[i],j+2],If[j==7,0,Part[V[i],1]]],9],{j,0,8}]]]<9,Goto[aa]];
    m=m+1;Print[m,":"," ",0," ",Part[V[i],1]," ",Part[V[i],2]," ",Part[V[i],3]," ",Part[V[i],4]," ",Part[V[i],5]," ",Part[V[i],6]," ",Part[V[i],7]," ",Part[V[i],8]];Label[aa];Continue,{i,1,8!}]

Extensions

a(10)-a(18) from Bert Dobbelaere, Sep 08 2019
a(19) from Robin Visser, Sep 24 2023

A227399 Number of permutations i_1, ..., i_n of 1, ..., n with i_1 = 1 and i_n = n such that i_1+2*i_2, i_2+2*i_3, ..., i_{n-1}+2*i_n, i_n+2*i_1 are pairwise distinct modulo n.

Original entry on oeis.org

1, 1, 0, 1, 1, 2, 8, 20, 18, 166, 397, 2788, 5448, 78102, 149562, 2576896, 6003432, 91012592, 257246112, 5272355344, 12450552690
Offset: 1

Views

Author

Zhi-Wei Sun, Sep 20 2013

Keywords

Comments

If n is not divisible by 3 then a(n) > 0 since the identical permutation of 1 ,..., n works for the purpose. If n is even, then a(n) > 0 since the permutation 1, 2, n-1, 4, n-3, 6, n-5, ..., n-2, 3, n meets the requirement. We guess that a(n) > 0 in the remaining case n = 6q+3 with q > 0. If n = 2k+1 == 3 (mod 6) with n > 3, then, for the permutation (i_1,...,i_n) = (1,2k,k,2k-1,k-1,2k-2,...,3,k+2,2,k+1,2k+1), all the n sums i_1+2*i_2, i_2+2*i_3, ..., i_{n-1}+2*i_n, i_n+2*i_1 are pairwise distinct (but they are not pairwise incongruent modulo n = 2k+1 when n > 9).
Zhi-Wei Sun also made the following general conjecture:
(i) (Weak version) Let a_1,...,a_n be n distinct elements of an additive abelian group G. Then, there is a permutation b_1,...,b_n of a_1,...,a_n such that a_1+2*b_1, a_2+2*b_2, ..., a_n+2*b_n are pairwise distinct. (The author has proved this for n up to 4 in any abelian group G.)
(ii) (Strong version) Let A be any subset of an additive abelian group G with |A| = n > 4. Then there is a numbering a_1, ..., a_n of all the elements of A such that a_1+2*a_2, a_2+2*a_3, ..., a_{n-1}+2*a_n, a_n+2*a_1 are pairwise distinct. (The author has proved this for any torsion-free abelian group G.)
Recall that a conjecture of Snevily proved by Arsovski states that for any two n-subsets A and B of an additive abelian group of odd order there is a numbering a_1,...,a_n of all the elements of A and a numbering b_1, ..., b_n of all the elements of B such that the n sums a_1+b_1, ..., a_n+b_n are pairwise distinct.

Examples

			a(6) = 2 due to the permutations 1,2,5,4,3,6 and 1,4,3,2,5,6.
a(9) > 0 due to the permutation 1,2,3,5,8,4,7,6,9.
a(12) > 0 due to the permutation 1,2,3,4,6,8,5,11,10,7,9,12.
		

Crossrefs

Programs

  • Mathematica
    (* A program to compute desired permutations for n = 9. *)
    V[i_]:=Part[Permutations[{2,3,4,5,6,7,8}],i]
    m=0
    Do[If[Length[Union[{2},Table[Mod[If[j==0,1,Part[V[i],j]]+2*If[j<7,Part[V[i],j+1],9],9],{j,0,7}]]]<9,Goto[aa]];
    m=m+1;Print[m,":"," ",1," ",Part[V[i],1]," ",Part[V[i],2]," ",Part[V[i],3]," ",Part[V[i],4]," ",Part[V[i],5]," ",Part[V[i],6]," ",Part[V[i],7]," ",9];Label[aa];Continue,{i,1,7!}]

Extensions

a(12)-a(21) from Robin Visser, Aug 21 2023
Showing 1-6 of 6 results.