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: Lars-Erik Svahn

Lars-Erik Svahn's wiki page.

Lars-Erik Svahn has authored 5 sequences.

A179295 a(n) is the least prime number such that prime(n)+a(n)+1 is a prime or -1 if no such prime number exists.

Original entry on oeis.org

2, 3, 5, 3, 5, 3, 5, 3, 5, 7, 5, 3, 5, 3, 5, 5, 7, 5, 3, 7, 5, 3, 5, 7, 3, 5, 3, 5, 3, 13, 3, 5, 11, 11, 7, 5, 5, 3, 5, 5, 11, 11, 5, 3, 13, 11, 11, 3, 5, 3, 5, 11, 29, 5, 5, 5, 7, 5, 3, 11, 23, 13, 3, 5, 3, 13, 5, 11, 5, 3, 5, 7, 5, 5, 3, 5, 7, 3, 7, 11, 11
Offset: 1

Author

Lars-Erik Svahn, Jun 21 2017

Keywords

Comments

If Maillet's conjecture is true, then a(n) != -1 for all n. - Chai Wah Wu, Aug 01 2017

Examples

			a(1) = 2, since prime(1) + 2 + 1 = 5.
		

Programs

  • Mathematica
    Table[Block[{p=2}, While[!PrimeQ[Prime[n] + p + 1], p=NextPrime[p]]; p],{n, 100}] (* Indranil Ghosh, Jun 30 2017 *)
  • PARI
    a(n) = my(pn=prime(n), p=2); while(! isprime(pn+p+1), p = nextprime(p+1)); p; \\ Michel Marcus, Jun 30 2017
    
  • Python
    from sympy import prime, isprime, nextprime
    def a(n):
        p=2
        while not isprime(prime(n) + p + 1): p=nextprime(p)
        return p
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 30 2017

Extensions

Definition clarified by Chai Wah Wu, Aug 01 2017
More terms from Chai Wah Wu, Aug 02 2017

A284346 a(n) is the least positive integer such that n^2 + a(n)^2 and (n + 1)^2 + (a(n) + 1)^2 are primes.

Original entry on oeis.org

2, 1, 8, 1, 4, 1, 2, 3, 16, 3, 6, 7, 8, 1, 4, 1, 22, 5, 6, 3, 4, 17, 18, 5, 4, 1, 32, 5, 10, 29, 4, 27, 8, 15, 18, 1, 2, 15, 10, 3, 4, 247, 8, 15, 14, 19, 22, 35, 6, 19, 4, 27, 10, 11, 8, 1, 2, 5, 40, 13, 44, 127, 58, 61, 28, 1, 22, 13, 10, 19, 6, 7, 8, 15, 4, 9
Offset: 1

Author

Lars-Erik Svahn, Mar 25 2017

Keywords

Comments

n is odd iff a(n) is even.

Examples

			a(1)=2 since (1 + 1)^2 + (1 + 1)^2 is not prime, but 1^2 + 2^2 = 5 and (1 + 1)^2 + (2 + 1)^2 = 13 are prime.
		

Crossrefs

Programs

  • Mathematica
    Rest@ FoldList[Module[{k = 1}, While[Times @@ Boole@ Map[PrimeQ, {#2^2 + k^2, (#2 + 1)^2 + (k + 1)^2}] < 1, k++]; k] &, 1, Range@ 76] (* Michael De Vlieger, Mar 25 2017 *)
  • PARI
    a(n) = my(k=0); while (! (isprime(n^2+k^2) && isprime((n+1)^2+(k+1)^2)), k++); k;  \\ Michel Marcus, Mar 25 2017

A284376 a(n) is the least nonnegative integer such that n + i*a(n) is a Gaussian prime.

Original entry on oeis.org

3, 1, 1, 0, 1, 2, 1, 0, 3, 4, 1, 0, 7, 2, 1, 2, 1, 2, 5, 0, 1, 4, 5, 0, 1, 4, 1, 2, 5, 4, 11, 0, 3, 2, 5, 2, 1, 2, 3, 10, 1, 4, 5, 0, 9, 2, 5, 0, 13, 4, 7, 4, 3, 10, 1, 4, 1, 2, 3, 0, 13, 10, 3, 32, 9, 2, 1, 0, 5, 10, 3, 0, 5, 2, 1, 4, 5, 10, 7, 0, 7, 4, 3, 0, 1, 2, 9, 2, 3, 4, 1, 4, 7, 8, 1, 2, 5, 2, 3, 4, 3
Offset: 0

Author

Lars-Erik Svahn, Mar 25 2017

Keywords

Crossrefs

Programs

  • Maple
    f:= proc(n) local k;
      for k from 0 do if GaussInt:-GIprime(n+I*k) then return k fi od
    end proc:
    map(f, [$0..100]); # Robert Israel, Apr 07 2017
  • Mathematica
    Table[k = 0; While[! PrimeQ[n + I k, GaussianIntegers -> True], k++]; k, {n, 0, 100}] (* Michael De Vlieger, Mar 29 2017 *)

Formula

From Michel Marcus, Mar 30 2017: (Start)
a(n) = 0 for n in A002145.
a(n) = 1 for n in A005574.
(End)
a(n) = A069003(n) if n is not in A002145. - Robert Israel, Apr 07 2017

A284327 a(n) is the least positive integer such that n^2 + a(n)^2 and n^2 + (a(n) - 2)^2 are primes.

Original entry on oeis.org

1, 1, 10, 1, 4, 1, 10, 5, 16, 1, 6, 25, 10, 1, 4, 1, 10, 7, 16, 1, 46, 15, 20, 1, 6, 1, 22, 15, 6, 13, 6, 5, 190, 11, 18, 1, 30, 15, 46, 1, 46, 25, 10, 21, 16, 21, 10, 37, 6, 19, 16, 5, 12, 1, 6, 1, 52, 5, 26, 31, 26, 45, 40, 11, 4, 1, 20, 7, 196, 19, 16
Offset: 1

Author

Lars-Erik Svahn, Mar 25 2017

Keywords

Comments

n + i*a(n) and n + i*(a(n) - 2) are Gaussian twin primes.
If n^2 + 1 is a prime then a(n) = 1 else a(n) = A284211(n) + 2.

Examples

			a(1) = 1 since 1^2 + 1^2 = 2 and 1^2 + (1 - 2)^2 = 2 are primes.
		

Crossrefs

Programs

  • Mathematica
    Rest@ FoldList[Module[{k = 1}, While[Times @@ Boole@ Map[PrimeQ, {#2^2 + k^2, #2^2 + (k - 2)^2}] < 1, k++]; k] &, 1, Range@ 71] (* Michael De Vlieger, Mar 25 2017 *)
  • PARI
    a(n) = k=0; while (! (isprime(n^2+k^2) && isprime(n^2+(k-2)^2)), k++); k; \\ Michel Marcus, Mar 25 2017
    
  • Python
    from sympy import isprime
    def a(n):
        k=0
        while True:
            if isprime(n**2 + k**2) and isprime(n**2 + (k - 2)**2): return k
            else: k+=1
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Mar 31 2017

Formula

a(n) = 1 for n in A005574. - Michel Marcus, Mar 31 2017

A284211 a(n) is the least positive integer such that n^2 + a(n)^2 and n^2 + (a(n) + 2)^2 are primes.

Original entry on oeis.org

2, 1, 8, 9, 2, 29, 8, 3, 14, 1, 4, 23, 8, 9, 2, 29, 8, 5, 14, 1, 44, 13, 18, 59, 4, 9, 20, 13, 4, 11, 4, 3, 188, 9, 16, 149, 28, 13, 44, 1, 44, 23, 8, 19, 14, 19, 8, 35, 4, 17, 14, 3, 10, 59, 4, 9, 50, 3, 24, 29, 24, 43, 38, 9, 2, 89, 18, 5, 194, 17, 14, 5
Offset: 1

Author

Lars-Erik Svahn, Mar 23 2017

Keywords

Comments

z = n + i*a(n) and z' = n + i*(a(n) + 2) are two Gaussian primes such that |z - z'| = 2, corresponding to twin primes.

Examples

			a(1)=2: 1^2 + 1^2 = 2 is a prime but 1 + (1 + 2)^2 = 10 is not, while 1^2 + 2^2 = 5 and 1^2 + (2+2)^2 = 17 are both primes.
		

Crossrefs

Cf. A069003.

Programs

  • Maple
    f:= proc(n) local k,pp,p;
        pp:= false;
        for k from (n+1) mod 2 by 2 do
          p:= isprime(n^2 + k^2);
          if p and pp then return k-2 fi;
          pp:= p;
        od;
    end proc:
    map(f, [$1..100]); # Robert Israel, Mar 30 2017
  • Mathematica
    a[n_] := Block[{k = Mod[n, 2] + 1}, While[! PrimeQ[n^2 + k^2] || ! PrimeQ[n^2 + (k + 2)^2], k += 2]; k]; Array[a, 72] (* Giovanni Resta, Mar 23 2017 *)
    lpi[n_]:=Module[{k=1},While[!AllTrue[n^2+{k^2,(k+2)^2},PrimeQ],k++];k]; Array[lpi,80] (* Harvey P. Dale, Aug 15 2024 *)
  • PARI
    a(n) = my(k=n%2+1); while (!(isprime(n^2+k^2) && isprime(n^2+(k+2)^2)), k+=2); k  \\ Michel Marcus, Mar 25 2017