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.

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