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

A267098 a(n) = number of 4k+3 primes among first n primes; least monotonic left inverse of A080148.

Original entry on oeis.org

0, 1, 1, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 13, 13, 13, 13, 14, 15, 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 23, 24, 25, 26, 27, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 38, 38, 39, 40, 40, 40, 40, 40, 41, 41, 42
Offset: 1

Views

Author

Antti Karttunen, Feb 01 2016

Keywords

Comments

a(n) = number of 4k+3 primes (A002145) among primes in range 2 .. A000040(n).

Crossrefs

Programs

  • Mathematica
    Accumulate[Table[If[IntegerQ[(n-3)/4],1,0],{n,Prime[Range[90]]}]] (* Harvey P. Dale, Mar 07 2018 *)

Formula

Other identities. For all n >= 1:
a(A080148(n)) = n.
a(n) + A267097(n) = n-1.

A267107 "Chebyshev's bat permutation": a(1) = 1, a(A080147(n)) = A080148(a(n)), a(A080148(n)) = A080147(a(n)).

Original entry on oeis.org

1, 3, 2, 7, 6, 5, 4, 16, 13, 14, 12, 11, 9, 10, 35, 8, 29, 31, 30, 26, 23, 25, 21, 27, 22, 20, 24, 74, 17, 19, 18, 62, 67, 66, 15, 65, 54, 57, 51, 58, 55, 56, 45, 48, 43, 59, 50, 44, 53, 47, 39, 152, 49, 37, 41, 42, 38, 40, 46, 144, 130, 32, 139, 137, 36, 34, 33, 118, 136, 129, 128, 113, 121, 28, 108, 122, 125
Offset: 1

Views

Author

Antti Karttunen, Feb 01 2016

Keywords

Comments

This is a self-inverse permutation of natural numbers.

Crossrefs

Cf. A268393 (record positions), A268394 (record values).
Cf. A267100, A267105, A267106 and also A270193, A270194, A270199, A270201, A270202 for other similarly constructed permutations based on prime distribution biases.

Programs

  • PARI
    allocatemem(2^30);
    default(primelimit,4294965247);
    uplim = 2^20;
    uplim2 = 366824; \\ Very ad hoc.
    v080147 = vector(uplim);
    v080148 = vector(uplim);
    v267097 = vector(uplim);
    v267107 = vector(uplim);
    v267097[1] = 0; c = 0; v47i = 0; v48i = 0; for(n=2, uplim, if((1 == (prime(n)%4)), c++; v47i++; v080147[v47i] = n, v48i++; v080148[v48i] = n); v267097[n] = c; if(!(n%32768),print1(" n=",n)));
    A080147(n) = v080147[n];
    A080148(n) = v080148[n];
    A267097(n) = v267097[n];
    A267098(n) = (n - A267097(n))-1;
    A267107(n) = v267107[n];
    v267107[1] = 1; for(n=2, uplim2, if((1 == (prime(n) % 4)), v267107[n] = A080148(A267107(A267097(n))), v267107[n] = A080147(A267107(A267098(n))));  if(!(n%32768),print1(" n=",n)));
    for(n=1, uplim2, write("b267107.txt", n, " ", A267107(n)));
    
  • Scheme
    ;; With memoization-macro definec
    (definec (A267107 n) (cond ((<= n 1) n) ((= 1 (modulo (A000040 n) 4)) (A080148 (A267107 (A267097 n)))) (else (A080147 (A267107 (A267098 n))))))

Formula

a(1) = 1; and for n > 1, if prime(n) modulo 4 = 1, a(n) = A080148(a(A267097(n))), otherwise a(n) = A080147(a(A267098(n))).

Extensions

Name changed, the old name was "Manta moth permutation" - Antti Karttunen, Dec 10 2019

A267100 Self-inverse permutation of natural numbers: a(1) = 1, a(A080147(n)) = A080148(n), a(A080148(n)) = A080147(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Feb 01 2016

Keywords

Crossrefs

Cf. also A267107 (a more recursed variant).

Formula

a(1) = 1; for n > 1, if prime(n) mod 4 = 1, then a(n) = A080148(A267097(n)), otherwise a(n) = A080147(A267098(n)).
Other identities. For all n >= 1:
a(n) = A000720(A267101(n)).

A267105 Permutation of natural numbers: a(1) = 1, a(A080147(n)) = 1+(2*a(n)), a(A080148(n)) = 2*a(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Feb 01 2016

Keywords

Crossrefs

Formula

a(1) = 1; and for n > 1, if prime(n) mod 4 = 1, then a(n) = 1 + 2*a(A267097(n)), otherwise a(n) = 2*a(A267098(n)).

A267106 Permutation of natural numbers: a(1) = 1, a(2n) = A080148(a(n)), a(2n+1) = A080147(a(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Feb 01 2016

Keywords

Comments

This sequence can be represented as a binary tree. Each left hand child is produced as A080148(n), and each right hand child as A080147(n), when the parent node contains n:
|
...................1...................
2 3
4......../ \........6 5......../ \........7
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
8 10 11 13 9 12 14 16
15 18 19 24 20 25 23 29 17 21 22 26 27 30 31 35
etc.

Crossrefs

Inverse: A267105.
Cf. also A267107.

Formula

a(1) = 1, after which, a(2n) = A080148(a(n)), a(2n+1) = A080147(a(n)).

A080147 Positions of primes of the form 4*k+1 (A002144) among all primes (A000040).

Original entry on oeis.org

3, 6, 7, 10, 12, 13, 16, 18, 21, 24, 25, 26, 29, 30, 33, 35, 37, 40, 42, 44, 45, 50, 51, 53, 55, 57, 59, 60, 62, 65, 66, 68, 70, 71, 74, 77, 78, 79, 80, 82, 84, 87, 88, 89, 97, 98, 100, 102, 104, 106, 108, 110, 112, 113, 116, 119, 121, 122, 123, 126, 127, 130, 134, 135
Offset: 1

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Comments

The asymptotic density of this sequence is 1/2 (by Dirichlet's theorem). - Amiram Eldar, Mar 01 2021

Examples

			7 is in the sequence because the 7th prime, 17, is of the form 4k+1.
4 is not in the sequence because the 4th prime, 7, is not of the form 4k+1.
		

Crossrefs

Almost complement of A080148 (1 is excluded from both).

Programs

  • Maple
    with(numtheory,ithprime); pos_of_primes_k_mod_n(300,1,4);
    pos_of_primes_k_mod_n := proc(upto_i,k,n) local i,a; a := []; for i from 1 to upto_i do if(k = (ithprime(i) mod n)) then a := [op(a),i]; fi; od; RETURN(a); end;
    with(Bits): for n from 1 to 135 do if (And(ithprime(n),2)=0) then print(n) fi od; # Gary Detlefs, Dec 26 2011
  • Mathematica
    Select[Range[135], Mod[Prime[#], 4] == 1 &] (* Amiram Eldar, Mar 01 2021 *)
  • PARI
    k=0;forprime(p=2,1e4,k++;if(p%4==1,print1(k", "))) \\ Charles R Greathouse IV, Dec 27 2011

Formula

A002144(n) = A000040(a(n)).
Numbers k such that prime(k) AND 2 = 0. - Gary Detlefs, Dec 26 2011

A080117 Binary encoding of quadratic residue set formed for n-th prime, coerced to "complementarily symmetric binary sequence" with A080261 if the prime is of the form 4k+1.

Original entry on oeis.org

2, 10, 52, 738, 2866, 53620, 162438, 4023888, 166243974, 921787428, 48034443442, 935251508324, 2558696229078, 68055676507664, 2655011787909270, 210067141980993186, 831463106366605026, 42882922858578320598
Offset: 2

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Crossrefs

Programs

  • Maple
    with(numtheory,ithprime); A080117 := proc(n) local c,p; p := ithprime(n); c := A055094(p); if(3 = (p mod 4)) then RETURN(c); else RETURN(A080261(c)); fi; end;
  • Mathematica
    A055094[n_] := With[{rr = Table[Mod[k^2, n], {k, 1, n-1}] // Union}, Boole[ MemberQ[rr, #]] & /@ Range[n-1]] // FromDigits[#, 2]&;
    A080261[n_] := Module[{bb = IntegerDigits[n, 2]}, lg = Length[bb]; Do[ bb[[i]] = 1 - bb[[i]], {i, lg, lg - Floor[lg/2] + 1, -1}]; FromDigits[ bb, 2]];
    a[n_] := Module[{c, p = Prime[n]}, c = A055094[p]; If[Mod[p, 4] == 3, c, A080261[c]]]; Table[a[n], {n, 2, 20}] (* Jean-François Alcover, Mar 05 2016, adapted from Maple *)
  • Sage
    # uses[A080261]
    def A080117(n) :
        p = nth_prime(n)
        c = A055094(p)
        return c if 3 == p%4 else A080261(c)
    [A080117(n) for n in (2..19)] # Peter Luschny, Aug 09 2012

Formula

a(A080148(n)) = A080146(A080148(n))

A080146 Binary encoding of quadratic residue set for each prime. a(n) = A055094(A000040(n)).

Original entry on oeis.org

1, 2, 9, 52, 738, 2829, 53643, 162438, 4023888, 166236537, 921787428, 48034254669, 935251837851, 2558696229078, 68055676507664, 2655011771373417, 210067141980993186, 831463105466530077, 42882922858578320598
Offset: 1

Views

Author

Antti Karttunen, Feb 11 2003

Keywords

Crossrefs

Programs

  • Maple
    with(numtheory,ithprime); A080146 := n -> A055094(ithprime(n));
  • Mathematica
    A055094[n_] := With[{rr = Table[Mod[k^2, n], {k, 1, n-1}] // Union}, Boole[MemberQ[rr, #]]& /@ Range[n-1]] // FromDigits[#, 2]&;
    a[n_] := A055094[Prime[n]];
    Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Sep 20 2022 *)
  • PARI
    a(n) = my(p=prime(n)); sum(k=1, p-1, 2^(k-1)*(0Michel Marcus, Sep 20 2022; after A055094

Formula

a(A080148(n)) = A080117(A080148(n)).

A170821 Let p = n-th prime; a(n) = smallest k >= 0 such that 4k == 3 mod p.

Original entry on oeis.org

0, 2, 6, 9, 4, 5, 15, 18, 8, 24, 10, 11, 33, 36, 14, 45, 16, 51, 54, 19, 60, 63, 23, 25, 26, 78, 81, 28, 29, 96, 99, 35, 105, 38, 114, 40, 123, 126, 44, 135, 46, 144, 49, 50, 150, 159, 168, 171, 58, 59, 180, 61, 189, 65, 198, 68, 204, 70, 71, 213, 74, 231, 234, 79, 80, 249, 85, 261
Offset: 2

Views

Author

N. J. A. Sloane, Dec 24 2009

Keywords

Crossrefs

Programs

  • Maple
    f:=proc(n) local b; for b from 0 to n-1 do if 4*b mod n = 3 then RETURN(b); fi; od: -1; end; [seq(f(ithprime(n)),n=2..100)]; # Gives wrong answer for n=2.
    # Alternative:
    f:= n -> 3/4 mod ithprime(n):
    map(f, [$2..100]); # Robert Israel, Dec 03 2018
  • Mathematica
    a[n_] := If[n<3, 0, Module[{p=Prime[n], k=0}, While[Mod[4k, p] != 3, k++]; k]]; Array[a, 100,2] (* Amiram Eldar, Dec 03 2018 *)
  • PARI
    a(n) = my(p=prime(n), k=0); while(Mod(4*k, p) != 3, k++); k; \\ Michel Marcus, Dec 03 2018

Formula

a(n) = (prime(n)+3)/4 if n is in A080147, (3*prime(n)+3)/4 if n is in A080148 (except for n=2). - Robert Israel, Dec 03 2018

A126330 Primes of the form 4p+3 where p is a prime.

Original entry on oeis.org

11, 23, 31, 47, 71, 79, 127, 151, 167, 191, 239, 271, 359, 431, 439, 599, 607, 631, 719, 727, 911, 919, 967, 1031, 1087, 1231, 1327, 1399, 1439, 1471, 1559, 1607, 1759, 1831, 1847, 1871, 1951, 1999, 2039, 2087, 2287, 2311, 2351, 2399, 2591, 2647, 2711, 2767
Offset: 1

Views

Author

J. M. Bergot, Mar 09 2007

Keywords

Crossrefs

For the primes p see A023213.

Programs

  • Maple
    select(p -> isprime(p) and isprime((p-3)/4), [seq(p,p=7..10000,4)]); # Robert Israel, Aug 08 2019
  • Mathematica
    Select[3 + 4Prime@Range[130], PrimeQ] (* Ray Chandler, Jun 29 2008 *)

Extensions

Checked and extended by N. J. A. Sloane, Mar 10 2007
Showing 1-10 of 16 results. Next