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: Gary E. Davis

Gary E. Davis's wiki page.

Gary E. Davis has authored 7 sequences.

A339267 Level of the Calkin-Wilf tree in which the n-th convergent of the continued fraction for e appears.

Original entry on oeis.org

2, 3, 5, 6, 7, 11, 12, 13, 19, 20, 21, 29, 30, 31, 41, 42, 43, 55, 56, 57, 71, 72, 73, 89, 90, 91, 109, 110, 111, 131, 132, 133, 155, 156, 157, 181, 182, 183, 209, 210, 211, 239, 240, 241, 271, 272, 273, 305, 306, 307, 341, 342, 343, 379, 380, 381, 419, 420, 421, 461
Offset: 1

Author

Gary E. Davis, Nov 29 2020

Keywords

Comments

The depth level of a rational in the Calkin-Wilf tree is the sum of its continued fraction terms, with the root (1/1) as level 1 for this purpose. So the present sequence is partial sums of the continued fraction terms of e (A003417). Depth levels are the same in the related trees Stern-Brocot, Bird, etc. - Kevin Ryde, Dec 26 2020

Examples

			a(1) = 2 since 1st convergent 2, to e, appears at level 2 of the Calkin-Wilf tree.
a(2) = 3 since 2nd convergent 3 appears at level 3, a(3) = 5 since 3rd convergent 8/3 appears at level 5.
		

Crossrefs

Cf. A002487, A003417 (continued fraction for e), A007676/A007677 (convergents).

Programs

  • Mathematica
    children[{a_,b_}]:={{a,a+b},{a+b,b}};
    frac[{a_,b_}]:=a/b;
    L[1]={{1,1}};
    L[n_]:=Flatten[Map[children,L[n-1]],1];
    CWLevel[n_]:=Map[frac,If[n==1,L[1],Complement[L[n],L[n-1]]]];
    WhereCW[{a0_,b0_}]:=Module[{a=a0,b=b0,steps},steps =1;While[a>1 || b>1,{a,b}=parent[{a,b}];steps++];steps];
    fracpair[k_]:={Numerator[FromContinuedFraction[ContinuedFraction[E,k]]],Denominator[FromContinuedFraction[ContinuedFraction[E,k]]]};
    Table[WhereCW[fracpair[k]],{k,1,60}]
  • PARI
    a(n) = sqr(n\3) + n + 1; \\ Kevin Ryde, Dec 26 2020

Formula

a(n) = a(n-1) + 2*a(n-3) - 2*a(n-4) - a(n-6) + a(n-7) for n > 7.
a(n) = floor(n/3)^2 + n + 1. - Kevin Ryde, Dec 26 2020
G.f.: x*(2 + x + 2*x^2 - 3*x^3 - x^4 + x^6)/((1 - x)^3*(1 + x + x^2)^2). - Stefano Spezia, Dec 27 2020

A300158 Absolute value of product of nonzero eigenvalues of upper left (n+1)X(n+1) rank 2 submatrix of Wythoff array.

Original entry on oeis.org

1, 1, 4, 8, 20, 38, 77, 143, 267, 474, 856, 1540, 2703, 4749, 8204, 14233, 24714, 42234, 72495, 122930, 209534, 357733, 603816, 1023096, 1735667, 2915260, 4913350, 8216036, 13794118, 23198608, 38710749, 64802028, 108623872, 180780234, 301734372, 500717764, 833682438, 1390233453, 2304627170
Offset: 1

Author

Gary E. Davis, Feb 26 2018

Keywords

Comments

Empirical observation via computation.

Examples

			a(1) = 1 = |(4 + sqrt(17))*(4 - sqrt(17))|;
a(2) = 1 = |(12 + sqrt(145))*(1/(-12 - sqrt(145)))|;
a(3) = 4 = (1/2)*(63 + sqrt(3985))*(8/(-63 - sqrt(3985))).
		

Crossrefs

Cf. A035513.

Programs

  • Mathematica
    \[Phi] = (1 + Sqrt[5])/2;
    A[m_, 1] := Floor[Floor[m*\[Phi]]*\[Phi]]
    A[m_, 2] := Floor[Floor[m*\[Phi]]*\[Phi]^2]
    A[m_, n_] := A[m, n] = A[m, n - 1] + A[m, n - 2]
    M[n_] := Table[A[i, j], {i, 1, n}, {j, 1, n}]
    X = Table[{n, -Simplify[Eigenvalues[M[n]][[1 ;; 2]][[1]]*Eigenvalues[M[n]][[1 ;; 2]][[2]]]}, {n, 2, 40}]

A276986 Numbers n for which there is a permutation p of (1,2,3,...,n) such that k+p(k) is a Catalan number for 1<=k<=n.

Original entry on oeis.org

0, 1, 3, 4, 9, 10, 12, 13, 28, 29, 31, 32, 37, 38, 40, 41, 90, 91, 93, 94, 99, 100, 102, 103, 118, 119, 121, 122, 127, 128, 130, 131, 297, 298, 300, 301, 306, 307, 309, 310, 325, 326, 328, 329, 334, 335, 337, 338, 387, 388, 390, 391, 396, 397, 399, 400, 415, 416
Offset: 1

Author

Gary E. Davis, Sep 24 2016

Keywords

Comments

A001453 is a subsequence. - Altug Alkan, Sep 29 2016
n>=1 is in the sequence if and only if there is a Catalan number c such that c/2 <= n < c and c-n-1 is in the sequence. - Robert Israel, Nov 20 2016

Examples

			3 is in the sequence because the permutation (1,3,2) added termwise to (1,2,3) yields (2,5,5) and both 2 and 5 are Catalan numbers.
		

Crossrefs

Programs

  • Maple
    S:= {0}:
    for i from 1 to 8 do
      c:= binomial(2*i,i)/(i+1);
      S:= S union map(t -> c - t - 1, S);
    od:
    sort(convert(S,list)); # Robert Israel, Nov 20 2016
  • Mathematica
    CatalanTo[n0_] :=
    Module[{n = n0}, k = 1; L = {};
      While[CatalanNumber[k] <= 2*n, L = {L, CatalanNumber[k]}; k++];
      L = Flatten[L]]
    perms[n0_] := Module[{n = n0, S, func, T, T2},
      func[k_] := Cases[CatalanTo[n], x_ /; 1 <= x - k <= n] - k;
      T = Tuples[Table[func[k], {k, 1, n}]];
      T2 = Cases[T, x_ /; Length[Union[x]] == Length[x]];
      Length[T2]]
    Select[Range[41], perms[#] > 0 &]

Formula

a(i) + a(2^n+1-i) = A000108(n+1)-1 for 1<=i<=2^n. - Robert Israel, Nov 20 2016

Extensions

More terms from Alois P. Heinz, Sep 28 2016
a(23)-a(58) from Robert Israel, Nov 18 2016

A276962 Numbers n such that n^17 - 1 is semiprime.

Original entry on oeis.org

20, 62, 84, 368, 410, 614, 720, 740, 762, 1230, 1280, 1988, 1998, 2064, 2100, 2268, 2312, 2468, 2678, 2940, 3002, 3324, 3392, 3462, 3768, 3848, 3968, 4178, 4244, 4680, 4968, 5022, 5024, 5198, 5304, 5382, 5624, 5822, 5850, 6048, 6248, 6338, 6354, 6398, 6428
Offset: 1

Author

Gary E. Davis, Sep 22 2016

Keywords

Comments

Least number such that n^17-1 and n^17+1 are both semiprime is 93888. - Altug Alkan, Sep 30 2016

Examples

			a(1) = 20 because 20^17-1 = 13107199999999999999999 = 19*689852631578947368421 is the first occurrence of n^17 - 1 as a product of two distinct primes.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[3000],PrimeOmega[#^17-1] == 2 &]
  • PARI
    isok(n) = bigomega(n^17-1)==2; \\ Michel Marcus, Sep 23 2016
    
  • PARI
    lista(nn) = forprime(p=2, nn, if(ispseudoprime(((p+1)^17-1)/p), print1(p+1, ", "))); \\ Altug Alkan, Sep 30 2016

Extensions

More terms from Altug Alkan, Sep 30 2016

A276905 Numbers k such that k^5-1 and k^5+1 are semiprimes.

Original entry on oeis.org

12, 1452, 11352, 79398, 146520, 281622, 352110, 536778, 643302, 680988, 723492, 739200, 878988, 992112, 1115268, 1189650, 1397022, 1698378, 1698510, 1728540, 1806222, 2486220, 2873178, 3031578, 3571458, 3946140, 4467012, 4983858, 5064510, 5135658, 5567562, 5753352
Offset: 1

Author

Gary E. Davis, Sep 21 2016

Keywords

Crossrefs

Intersection of A104238 and A261435.

Programs

  • Mathematica
    upper=600000;
    Select[Range[upper],
    PrimeOmega[#^5 - 1] == PrimeOmega[#^5 + 1] == 2 &]
  • PARI
    isok(n) = (bigomega(n^5-1)==2) && (bigomega(n^5+1)==2); \\ Michel Marcus, Sep 22 2016

Extensions

More terms from Altug Alkan, Sep 30 2016

A276735 Number of permutations p of (1..n) such that k+p(k) is a semiprime for 1 <= k <= n.

Original entry on oeis.org

1, 0, 0, 1, 1, 3, 5, 12, 87, 261, 324, 1433, 5881, 37444, 196797, 708901, 2020836, 12375966, 105896734, 955344450, 11136621319, 95274505723, 590283352231, 4285001635230, 36417581252044, 272699023606314
Offset: 0

Author

Gary E. Davis, Sep 24 2016

Keywords

Examples

			a(4) = 1 because the permutation (3,4,1,2) added termwise to (1,2,3,4) yields (4,6,4,6) - both semiprimes - and only that permutation does so. a(5) = 3 because exactly 3 permutations - (3,2,1,5,4), (3,4,1,2,5) & (5,4,3,2,1) - added termwise to (1,2,3,4,5) yield semiprime entries.
From _David A. Corneth_, Sep 28 2016 (Start):
The semiprimes up to 10 are 4, 6, 9 and 10. To find a(5), we add (1,2,3,4,5) to some p. Therefore, p(1) in {3, 5}, p(2) in {2, 4}, p(3) in {1, 3}, p(4) in {2, 5} and p(5) in {1, 4, 5}.
If p(1) = 3 then p(3) must be 1. Then {p(2), p(4), p(5)} = {2, 4, 5} for which there are two possibilities.
If p(1) = 5 then p(3) = 3 and p(4) = 2. Then p(2) = 4 and p(5) = 1. So there's one permutation for which p(1) = 5.
This exhausts the options for p(1) and we found 3 permutations. Therefore, a(5) = 3. (End)
		

Crossrefs

Programs

  • Maple
    with(LinearAlgebra): with(numtheory):
    a:= n-> `if`(n=0, 1, Permanent(Matrix(n, (i, j)->
            `if`((s-> bigomega(s)=2)(i+j), 1, 0)))):
    seq(a(n), n=0..16);  # Alois P. Heinz, Sep 28 2016
  • Mathematica
    perms[n0_] :=
    Module[{n = n0, S, func, T, T2},
      S = Select[Range[2, 2*n], PrimeOmega[#] == 2 &];
      func[k_] := Cases[S, x_ /; 1 <= x - k <= n] - k;
      T = Tuples[Table[func[k], {k, 1, n}]];
      T2 = Cases[T, x_ /; Length[Union[x]] == Length[x]];
      Length[T2]]
    Table[perms[n], {n, 0, 12}]
    (* Second program (version >= 10): *)
    a[0] = 1; a[n_] := Permanent[Table[Boole[PrimeOmega[i + j] == 2], {i, 1, n}, {j, 1, n}]]; Table[an = a[n]; Print[an]; an, {n, 0, 20}] (* Jean-François Alcover, Jul 25 2017 *)
  • PARI
    isok(va, vb)=my(v = vector(#va, j, va[j]+vb[j])); #select(x->(bigomega(x) == 2), v) == #v;
    a(n) = my(vpo = numtoperm(n,1)); sum(k=1, n!, vp = numtoperm(n,k); isok(vp, vpo)); \\ Michel Marcus, Sep 24 2016
    
  • PARI
    listA001358(lim)=my(v=List()); forprime(p=2, sqrtint(lim\1), forprime(q=p, lim\p, listput(v, p*q))); Set(v)
    has(v)=for(k=1,#v, if(!setsearch(semi, v[k]+k), return(0))); 1
    a(n)=local(semi=listA001358(2*n)); sum(k=1,n!, has(numtoperm(n,k))) \\ Charles R Greathouse IV, Sep 28 2016
    
  • PARI
    matperm(M)=my(n=matsize(M)[1], innerSums=vectorv(n)); if(n==0, return(1)); sum(x=1,2^n-1, my(k=valuation(x,2), s=M[,k+1], gray=bitxor(x,x>>1)); if(bittest(gray,k), innerSums+=s,innerSums-=s); (-1)^hammingweight(gray)*factorback(innerSums))*(-1)^n
    a(n)=matperm(matrix(n,n,x,y,bigomega(x+y)==2)) \\ Charles R Greathouse IV, Oct 03 2016

Extensions

More terms from Alois P. Heinz, Sep 28 2016

A276983 Semiprimes n such that n-1 or n+1 is prime.

Original entry on oeis.org

4, 6, 10, 14, 22, 38, 46, 58, 62, 74, 82, 106, 158, 166, 178, 194, 226, 262, 278, 314, 346, 358, 382, 398, 422, 458, 466, 478, 502, 542, 562, 586, 614, 662, 674, 718, 734, 758, 838, 862, 878, 886, 982, 998, 1018, 1094, 1154, 1186, 1202, 1214, 1238, 1282, 1306, 1318, 1322
Offset: 1

Author

Gary E. Davis, Sep 24 2016

Keywords

Comments

Union of A077065 and A077068.

Examples

			a(3) = 10 = 2*5 is a product of 2 primes and 10+1 = 11 is prime.
a(4) = 14 = 2*7 is a product of 2 primes and 14-1 = 13 is prime.
		

Crossrefs

Programs

  • Maple
    select(t -> isprime(t/2) and (isprime(t-1) or isprime(t+1)), [seq(i,i=2..10000,2)]); # Robert Israel, Sep 30 2016
  • Mathematica
    func[n_] := PrimeOmega[n] == 2 && (PrimeQ[n + 1] || PrimeQ[n - 1])
    Select[Range[1000], func[#] &]
  • PARI
    isok(n) = (bigomega(n)==2) && (isprime(n-1) || isprime(n+1)); \\ Michel Marcus, Sep 24 2016
    
  • PARI
    lista(nn) = forprime(p=2, nn, if(isprime(2*p+1) || isprime(2*p-1), print1(2*p, ", "))); \\ Altug Alkan, Sep 30 2016
    
  • Python
    from sympy import isprime, primerange
    def aupto(N): return [t for t in (2*p for p in primerange(2, N//2+1)) if isprime(t-1) or isprime(t+1)]
    print(aupto(1322)) # Michael S. Branicky, Aug 21 2022

Formula

a(n) = 2*A120628(n).