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.

Previous Showing 21-30 of 372 results. Next

A095105 Length of maximal Dyck path prefix in the Legendre-vector of the n-th 4k+3 prime (A002145(n)).

Original entry on oeis.org

2, 6, 10, 2, 22, 30, 2, 46, 58, 2, 70, 78, 82, 102, 6, 6, 130, 2, 150, 2, 166, 10, 190, 198, 2, 12, 60, 238, 250, 262, 270, 2, 2, 310, 2, 6, 358, 44, 2, 382, 418, 430, 438, 6, 6, 34, 478, 6, 34, 2, 502, 2, 2, 562, 2, 14, 598, 606, 2, 14, 2, 646, 658, 6, 2, 718
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Crossrefs

a(n)=A095104(n)-1 modulo A002145(n). Cf. A095107, A095270.

A385163 Let p = A002145(n) be the n-th prime == 3 (mod 4); a(n) is the multiplicative order of 1+-i modulo p in Gaussian integers.

Original entry on oeis.org

8, 24, 40, 72, 88, 40, 56, 184, 232, 264, 280, 312, 328, 408, 424, 56, 520, 552, 120, 648, 664, 712, 760, 792, 840, 296, 904, 952, 200, 1048, 1080, 376, 408, 1240, 120, 1384, 1432, 1464, 1512, 1528, 1672, 344, 584, 1768, 1848, 1864, 1912, 1944, 1960, 664, 2008, 2088, 2184, 2248, 456
Offset: 1

Views

Author

Jianing Song, Jun 20 2025

Keywords

Comments

Also, a(n) is the multiplicative order of the matrix [1,-1;1,1] or [1,1;-1,1] modulo p.
Note that (1+-i)^4 = -4. Since (1+-i)^n is a real number if and only if n is divisible by 4, we have a(n) = 4*ord(-4,p), where ord(a,p) is the multiplicative order of a modulo p.

Examples

			For A002145(4) = 19: Since (1+i)^(4k) = (-4)^k, we have (1+i)^72 == 1 (mod 19), and 72 is the smallest such exponent. Hence a(4) = 72.
		

Crossrefs

Cf. A002145, A384164 ({a(n)/8}), A385165 (multiplicative order of 2+-i).

Programs

  • PARI
    forprime(p=3, 1e3, if(p%4==3, print1(4*znorder(Mod(-4,p)), ", ")))

A217696 Let p = A002145(n) be the n-th prime of the form 4k+3, then a(n) is the smallest number such that p is the smallest prime of the form 4k+3 for which 4*a(n)+2-p is prime.

Original entry on oeis.org

1, 4, 10, 24, 76, 102, 196, 74, 104, 348, 314, 345, 86, 660, 443, 1494, 914, 1329, 2613, 1635, 1316, 1856, 1688, 2589, 2628, 6423, 3116, 2165, 6320, 4445, 7278, 4743, 16539, 17783, 6084, 3806, 6281, 8946, 15129, 6266, 10976, 19538, 16794, 31160, 32916, 57041
Offset: 1

Views

Author

Lei Zhou, Mar 19 2013

Keywords

Comments

It is conjectured that a(n) is defined for all positive integers.
This is also the index of first occurrence of the n-th prime in the form of 4k+3 in A214834.

Examples

			n=1: the first prime in the form of 4k+3 is 3, 3+3=6=4*1+2, so a(1)=1;
n=2: the second prime in the form of 4k+3 is 7, 7+7=14=3+11=4*3+2, and 11 is also a prime in the form of 4k+3, so a(2)!=3. 7+11=18=4*4+2=3+15, and 15 is not a prime number. So a(2)=4.
		

Crossrefs

Programs

  • Mathematica
    goal = 46; plst = {}; pct = 0; clst = {}; n = -1; While[pct < goal,
    n = n + 4; If[PrimeQ[n], AppendTo[plst, n]; AppendTo[clst, 0];
      pct++]]; n = 2; cct = 0; While[cct < goal, n = n + 4; p1 = n + 1;
    While[p1 = p1 - 4; p2 = n - p1; ! ((PrimeQ[p1]) && (PrimeQ[p2]) && (Mod[p2, 4] == 3))]; If[MemberQ[plst, p2], If[id = Position[plst, p2][[1, 1]]; clst[[id]] == 0, clst[[id]] = (n - 2)/4; cct++]]]; clst
  • PARI
    ok(n,p)=if(!isprime(n-p),return(0));forprime(q=2,p-1,if(q%4==3 && isprime(n-q),return(0)));1
    a(n)=my(p,k); forprime(q=2,,if(q%4==3&&n--==0,p=q;break)); k=(p+1)/4; while(!ok(4*k+2,p),k++); k \\ Charles R Greathouse IV, Mar 19 2013

A222299 Number of different Gaussian primes in the Gaussian prime spiral beginning at the n-th positive real Gaussian prime (A002145).

Original entry on oeis.org

8, 10, 172, 12, 168, 19, 19, 21, 21, 168, 14, 37, 37, 14, 18, 30, 68, 10, 10, 4, 10, 4, 29, 29, 32, 2484, 58, 30, 32, 2484, 76, 16, 10, 10, 18, 23, 23, 1861, 1861, 30, 34, 958, 126, 22, 10, 182, 10, 10, 74, 10, 112, 26, 48, 29, 29, 774, 13, 13, 26, 774, 18, 10
Offset: 1

Views

Author

T. D. Noe, Feb 25 2013

Keywords

Comments

The Gaussian prime spiral is described in the short note by O'Rourke and Wagon. It is not known if every iteration is a closed loop. See A222298 for the number of line segments between primes.

Examples

			The loop beginning with 31 is {31, 43, 43 - 8i, 37 - 8i, 37 - 2i, 45 - 2i, 45 - 8i, 43 - 8i, 43, 47, 47 - 2i, 45 - 2i, 45 + 2i, 47 + 2i, 47, 43, 43 + 8i, 45 + 8i, 45 + 2i, 37 + 2i, 37 + 8i, 43 + 8i, 43, 31, 31 + 4i, 41 + 4i, 41 - 4i, 31 - 4i, 31}. But only 19 are unique.
		

References

  • Joseph O'Rourke and Stan Wagon, Gaussian prime spirals, Mathematics Magazine, vol. 86, no. 1 (2013), p. 14.

Programs

  • Mathematica
    loop2[n_] := Module[{p = n, direction = 1}, lst = {n}; While[While[p = p + direction; ! PrimeQ[p, GaussianIntegers -> True]]; direction = direction*(-I); AppendTo[lst, p]; ! (p == n && direction == 1)]; Length[Union[lst]]]; cp = Select[Range[1000], PrimeQ[#, GaussianIntegers -> True] &]; Table[loop2[p], {p, cp}]

A247384 Find the first (maximal) string of consecutive primes of length exactly n which alternate between 4*k+1 and 4*k+3 or 4*k+3 and 4*k+1 as in A002144(4*n+1) and A002145(4*n+3). The first element is a(n).

Original entry on oeis.org

97, 11, 3, 23, 47, 167, 131, 2011, 233, 23633, 34499, 1013, 9341, 90659, 521, 51749, 505049, 1391087, 2264839, 2556713, 17123893, 2569529, 15090641, 18246451, 6160043, 1557431471, 43679609, 198572029, 701575297, 5552898499, 6639843979, 61233611783, 9005520203
Offset: 1

Views

Author

J. M. Bergot, Sep 15 2014

Keywords

Examples

			a(4)=23 because 23,29,31,37 alternate 4*n+3,4*n+1,4*n+3,4*n+1 for exactly four primes and 23 is the least prime for a string of exactly four.
		

Crossrefs

Programs

  • Maple
    Primes:= select(isprime,[seq(2*i+1,i=1..10^7)]):
    Pm4:= map(`modp`,[seq((-1)^j*Primes[j],j=1..nops(Primes))],4):
    Starts:= [1,op(select(t -> Pm4[t-1]<> Pm4[t], [$2..nops(Pm4)]))]:
    Lengths:= [seq(Starts[i+1]-Starts[i],i=1..nops(Starts)-1)]:
    for i from 1 to max(Lengths) do A[i]:= ListTools:-Search(i,Lengths) od:
    R:=[seq(A[i],i=1..max(Lengths))]:
    seq(`if`(a=0,0,Primes[Starts[a]]),a=R); # Robert Israel, Sep 15 2014
  • Mathematica
    i = 2; While[ Mod[ Prime[i] - Prime[i - 1], 4] != 0 || Mod[ Prime[i + 1] - Prime[i], 4] != 0, i++]; T = {Prime[i]}; Do[j = 2; While[! (Product[ Mod[ Prime[k + 1] - Prime[k], 4], {k, j, j + n}] != 0 && (Mod[Prime[j] - Prime[j - 1], 4] == 0 || j == 2) && Mod[ Prime[j + n + 2] - Prime[j + n + 1], 4] == 0), j++]; T = Append[T, Prime[j]], {n, 0, 13}]; T (* Jonathan Sondow, Jun 28 2017 *)
  • PARI
    v=vector(100);v[1]=7;cur=1;p=3;forprime(q=5, 1e10, if((q-p)%4==0,if(!v[cur],v[cur]=back(p,cur);print("a("cur") = "v[cur]));cur=1,cur++);p=q) \\ Charles R Greathouse IV, Sep 15 2014

Formula

a(n) = A289118(n) if and only if n > 1 and A289118(n) < A289118(n+1). - Jonathan Sondow, Jun 27 2017

Extensions

More terms from Jens Kruse Andersen, Oct 01 2014
Definition clarified by Jonathan Sondow, Jun 25 2017

A306529 x-value of the smallest solution to x^2 - p*y^2 = 2*(-1)^((p+1)/4), p = A002145(n).

Original entry on oeis.org

1, 3, 3, 13, 5, 39, 59, 7, 23, 221, 59, 9, 9, 477, 31, 2175, 103, 8807, 41571, 8005, 13, 2047, 2999, 127539, 527593, 15, 15, 2489, 1917, 373, 340551, 11759, 9409, 4109, 52778687, 801, 19, 137913, 113759383, 137, 16437, 12311, 21, 21, 15732537, 1275, 1729, 7204587, 305987, 67
Offset: 1

Views

Author

Jianing Song, Mar 25 2019

Keywords

Comments

a(n) exists for all n.
X = a(n)^2 - (-1)^((p+1)/4), Y = a(n)*A306566(n) gives the smallest solution to x^2 - p*y^2 = 1, p = A002145(n). As a result, all the positive solutions to x^2 - p*y^2 = 2*(-1)^((p+1)/4) are given by (x_n, y_n) where x_n + (y_n)*sqrt(p) = (a(n) + A306566(n)*sqrt(p))*(X + Y*sqrt(p))^n.

Examples

			The smallest solution to x^2 - p*y^2 = 2*(-1)^((p+1)/4) for the first primes congruent to 3 modulo 4:
  n |      Equation     | x_min | y_min
  1 | x^2 -  3*y^2 = -2 |     1 |     1
  2 | x^2 -  7*y^2 = +2 |     3 |     1
  3 | x^2 - 11*y^2 = -2 |     3 |     1
  4 | x^2 - 19*y^2 = -2 |    13 |     3
  5 | x^2 - 23*y^2 = +2 |     5 |     1
  6 | x^2 - 31*y^2 = +2 |    39 |     7
  7 | x^2 - 43*y^2 = -2 |    59 |     9
  8 | x^2 - 47*y^2 = +2 |     7 |     1
  9 | x^2 - 59*y^2 = -2 |    23 |     3
		

Crossrefs

Cf. A002145, A306566 (y-values).
Similar sequences: A094048, A094049 (x^2 - A002144(n)*y^2 = -1); A306618, A306619 (2*x^2 - A002145(n)*y^2 = (-1)^((p+1)/4)).

Programs

  • PARI
    b(p) = if(isprime(p)&&p%4==3, x=1; while(!issquare((x^2 - 2*(-1)^((p+1)/4))/p), x++); x)
    forprime(p=3, 500, if(p%4==3, print1(b(p), ", ")))

Formula

If the continued fraction of sqrt(A002145(n)) is [a_0; {a_1, a_2, ..., a_(k-1), a_k, a_(k-1), ..., a_1, 2*a_0}], where {} is the periodic part, let x/y = [a_0; a_1, a_2, ..., a_(k-1)], gcd(x, y) = 1, then a(n) = x and A306566(n) = y.

A306566 y-value of the smallest solution to x^2 - p*y^2 = 2*(-1)^((p+1)/4), p = A002145(n).

Original entry on oeis.org

1, 1, 1, 3, 1, 7, 9, 1, 3, 27, 7, 1, 1, 47, 3, 193, 9, 747, 3383, 627, 1, 153, 217, 9041, 36321, 1, 1, 161, 121, 23, 20687, 699, 537, 233, 2900979, 43, 1, 7199, 5843427, 7, 803, 593, 1, 1, 731153, 59, 79, 326471, 13809, 3, 7, 12507, 541137, 11, 563210019
Offset: 1

Views

Author

Jianing Song, Mar 25 2019

Keywords

Comments

a(n) exists for all n.
X = A306529(n)^2 - (-1)^((p+1)/4), Y = A306529(n)*a(n) gives the smallest solution to x^2 - p*y^2 = 1, p = A002145(n). As a result, all the positive solutions to x^2 - p*y^2 = 2*(-1)^((p+1)/4) are given by (x_n, y_n) where x_n + (y_n)*sqrt(p) = (A306529(n) + a(n)*sqrt(p))*(X + Y*sqrt(p))^n.

Examples

			The smallest solution to x^2 - p*y^2 = 2*(-1)^((p+1)/4) for the first primes congruent to 3 modulo 4:
  n |      Equation     | x_min | y_min
  1 | x^2 -  3*y^2 = -2 |     1 |     1
  2 | x^2 -  7*y^2 = +2 |     3 |     1
  3 | x^2 - 11*y^2 = -2 |     3 |     1
  4 | x^2 - 19*y^2 = -2 |    13 |     3
  5 | x^2 - 23*y^2 = +2 |     5 |     1
  6 | x^2 - 31*y^2 = +2 |    39 |     7
  7 | x^2 - 43*y^2 = -2 |    59 |     9
  8 | x^2 - 47*y^2 = +2 |     7 |     1
  9 | x^2 - 59*y^2 = -2 |    23 |     3
		

Crossrefs

Cf. A002145, A306529 (x-values).
Similar sequences: A094048, A094049 (x^2 - A002144(n)*y^2 = -1); A306618, A306619 (2*x^2 - A002145(n)*y^2 = (-1)^((p+1)/4)).

Programs

  • PARI
    b(p) = if(isprime(p)&&p%4==3, y=1; while(!issquare(p*y^2 + 2*(-1)^((p+1)/4)), y++); y)
    forprime(p=3, 500, if(p%4==3, print1(b(p), ", ")))

Formula

If the continued fraction of sqrt(A002145(n)) is [a_0; {a_1, a_2, ..., a_(k-1), a_k, a_(k-1), ..., a_1, 2*a_0}], where {} is the periodic part, let x/y = [a_0; a_1, a_2, ..., a_(k-1)], gcd(x, y) = 1, then A306529(n) = x and a(n) = y.

A306618 x-value of the smallest solution to 2*x^2 - p*y^2 = (-1)^((p+1)/4), p = A002145(n).

Original entry on oeis.org

1, 2, 7, 3, 78, 4, 51, 732, 277, 191, 6, 44, 20621, 122, 416941, 8, 5123, 25, 1034, 9, 3993882, 210107, 203100, 10, 1325, 5248, 65030839, 20107956, 30953, 4584105462, 1036, 4889, 295081, 58746, 20725, 98465863939, 1494439626, 1612, 10173, 6040149252, 102607, 9460742124
Offset: 1

Views

Author

Jianing Song, Mar 25 2019

Keywords

Comments

a(n) exists for all n.
X = 4*a(n)^2 - (-1)^((p+1)/4), Y = 2*a(n)*A306619(n) gives the smallest solution to x^2 - 2p*y^2 = 1, p = A002145(n).

Examples

			The smallest solution to 2*x^2 - p*y^2 = (-1)^((p+1)/4) for the first primes congruent to 3 modulo 4:
  n |       Equation      | x_min | y_min
  1 | 2*x^2 -  3*y^2 = -1 |     1 |     1
  2 | 2*x^2 -  7*y^2 = +1 |     2 |     1
  3 | 2*x^2 - 11*y^2 = -1 |     7 |     3
  4 | 2*x^2 - 19*y^2 = -1 |     3 |     1
  5 | 2*x^2 - 23*y^2 = +1 |    78 |    23
  6 | 2*x^2 - 31*y^2 = +1 |     4 |     1
  7 | 2*x^2 - 43*y^2 = -1 |    51 |    11
  8 | 2*x^2 - 47*y^2 = +1 |   732 |   151
  9 | 2*x^2 - 59*y^2 = -1 |   277 |    51
		

Crossrefs

Cf. A002145, A306619 (y-values).
Similar sequences: A094048, A094049 (x^2 - A002144(n)*y^2 = -1); A306529, A306566 (x^2 - A002145(n)*y^2 = 2*(-1)^((p+1)/4)).

Programs

  • PARI
    b(p) = if(isprime(p)&&p%4==3, x=1; while(!issquare((2*x^2 - (-1)^((p+1)/4))/p), x++); x)
    forprime(p=3, 250, if(p%4==3, print1(b(p), ", ")))

Formula

If the continued fraction of sqrt(2*A002145(n)) is [a_0; {a_1, a_2, ..., a_(k-1), a_k, a_(k-1), ..., a_1, 2*a_0}], where {} is the periodic part, let x/y = [a_0; a_1, a_2, ..., a_(k-1)], gcd(x, y) = 1, then a(n) = x/2 and A306619(n) = y.

A306619 y-value of the smallest solution to 2*x^2 - p*y^2 = (-1)^((p+1)/4), p = A002145(n).

Original entry on oeis.org

1, 1, 3, 1, 23, 1, 11, 151, 51, 33, 1, 7, 3201, 17, 57003, 1, 633, 3, 119, 1, 437071, 22209, 20783, 1, 129, 497, 6104097, 1839433, 399752993, 89, 411, 23817, 4711, 1611, 7475426163, 111543983, 119, 739, 436478927, 7089, 644468311, 103, 93487270491, 573497, 57, 4182991
Offset: 1

Views

Author

Jianing Song, Mar 25 2019

Keywords

Comments

a(n) exists for all n.
X = 4*A306618(n)^2 - (-1)^((p+1)/4), Y = 2*A306618(n)*a(n) gives the smallest solution to x^2 - 2p*y^2 = 1, p = A002145(n).

Examples

			The smallest solution to 2*x^2 - p*y^2 = (-1)^((p+1)/4) for the first primes congruent to 3 modulo 4:
  n |       Equation      | x_min | y_min
  1 | 2*x^2 -  3*y^2 = -1 |     1 |     1
  2 | 2*x^2 -  7*y^2 = +1 |     2 |     1
  3 | 2*x^2 - 11*y^2 = -1 |     7 |     3
  4 | 2*x^2 - 19*y^2 = -1 |     3 |     1
  5 | 2*x^2 - 23*y^2 = +1 |    78 |    23
  6 | 2*x^2 - 31*y^2 = +1 |     4 |     1
  7 | 2*x^2 - 43*y^2 = -1 |    51 |    11
  8 | 2*x^2 - 47*y^2 = +1 |   732 |   151
  9 | 2*x^2 - 59*y^2 = -1 |   277 |    51
		

Crossrefs

Cf. A002145, A306618 (x-values).
Similar sequences: A094048, A094049 (x^2 - A002144(n)*y^2 = -1); A306529, A306566 (x^2 - A002145(n)*y^2 = 2*(-1)^((p+1)/4)).

Programs

  • PARI
    b(p) = if(isprime(p)&&p%4==3, y=1; while(!issquare((p*y^2 + (-1)^((p+1)/4))/2), y++); y)
    forprime(p=3, 250, if(p%4==3, print1(b(p), ", ")))

Formula

If the continued fraction of sqrt(2*A002145(n)) is [a_0; {a_1, a_2, ..., a_(k-1), a_k, a_(k-1), ..., a_1, 2*a_0}], where {} is the periodic part, let x/y = [a_0; a_1, a_2, ..., a_(k-1)], gcd(x, y) = 1, then A306618(n) = x/2 and a(n) = y.

A094180 Numbers k such that 4*k-1 is divisible only by primes of form 4*m-1 (i.e., by the Gaussian primes A002145).

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 8, 11, 12, 15, 16, 17, 18, 20, 21, 25, 26, 27, 32, 33, 35, 37, 38, 41, 42, 43, 45, 48, 50, 52, 53, 56, 57, 58, 60, 61, 63, 66, 68, 70, 71, 77, 78, 83, 86, 87, 90, 91, 92, 95, 96, 97, 100, 105, 106, 108, 110, 111, 116, 117, 120, 121, 122, 123, 125, 126, 131
Offset: 1

Views

Author

Lekraj Beedassy, May 06 2004

Keywords

Crossrefs

For the actual numbers 4*k-1, see A094179.
Cf. A002145.

Programs

  • Mathematica
    Select[Range[150], AllTrue[FactorInteger[4*# - 1][[;; , 1]], Mod[#1, 4] == 3 &] &] (* Amiram Eldar, Apr 01 2021 *)
  • PARI
    {for(n=1,140,fac=factor(4*n-1);v=vector(matsize(fac)[1],j,fac[j,1])%4;if(vecmin(v)==3,print1(n,",")))} \\ Klaus Brockhaus, May 08 2004

Formula

a(n) = (A094179(n) + 1)/4. - Amiram Eldar, Apr 01 2021

Extensions

More terms from Klaus Brockhaus, May 08 2004
Previous Showing 21-30 of 372 results. Next