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-2 of 2 results.

A078606 Constant c(p) used in determining divisibility by the n-th prime, p=A000040(n), for n>=4.

Original entry on oeis.org

-2, -1, 4, -5, 2, 7, 3, -3, -11, -4, 13, -14, 16, 6, -6, -20, -7, 22, 8, 25, 9, -29, -10, 31, -32, 11, 34, -38, -13, -41, 14, 15, -15, -47, 49, -50, 52, 18, -18, -19, 58, -59, 20, -21, 67, -68, 23, 70, 24, -24, -25, -77, 79, 27, -27, -83, -28, 85, 88, -92, -31, 94, -95, -33, -101, -104, 35, 106, 36, -110, 112, 38
Offset: 4

Views

Author

Devora Rahav (rahav-d(AT)inter.net.il), Dec 09 2002

Keywords

Comments

To determine if N is divisible by p: Write N=10*M+D, where D=ones digit of N and M=N without ones digit. Then N is divisible by p iff M+c(p)*D is.
c(p) is the multiplicative inverse of 10 (mod p) with the smallest absolute value. (But note that the link below uses c(13)=9 rather than -4.)
For a given n, a(n) is either -A103876(n) or prime(n)-A103876(n), whichever has a smaller absolute value. - Nicholas Stefan Georgescu, Jan 18 2023

Examples

			The first few terms are c(7)=-2, c(11)=-1, c(13)=4. To find out if a number is divisible by 7, take the last digit, double it and subtract the result from the rest of the number. If you get an answer divisible by 7 (including 0), then the original number is divisible by 7. If you do not know the new number's divisibility, you can apply the rule again. Example: If you had 203, you would subtract 2*3=6 from 20 to get 14; since 14 is divisible by 7, so is 203.
		

Crossrefs

Programs

  • Mathematica
    c[p_] := If[(v=PowerMod[10, -1, p])>p/2, v-p, v]; c/@Prime/@Range[4, 100]
  • PARI
    a(n) = centerlift(Mod(1,prime(n))/10); \\ Kevin Ryde, Feb 18 2023
  • Python
    import sympy
    [(pow(10, -1, p))-p*(p%10%6==1) for p in sympy.primerange(7, 300)]
    # Nicholas Stefan Georgescu, Jan 18 2023
    

Extensions

Edited by Dean Hickerson, Dec 23 2002

A103876 a(n) = -1/10 (mod prime(n)): A test for divisibility by the n-th prime.

Original entry on oeis.org

2, 1, 9, 5, 17, 16, 26, 3, 11, 4, 30, 14, 37, 53, 6, 20, 7, 51, 71, 58, 80, 29, 10, 72, 32, 98, 79, 38, 13, 41, 125, 134, 15, 47, 114, 50, 121, 161, 18, 19, 135, 59, 179, 21, 156, 68, 206, 163, 215, 24, 25, 77, 184, 242, 27, 83, 28, 198, 205, 92, 31, 219, 95, 33, 101, 104
Offset: 4

Views

Author

Alfred S. Posamentier (asp2(AT)juno.com) and Robert G. Wilson v, Feb 10 2005

Keywords

Comments

Given a number M, remove its last digit d, then subtract d*a(n). If the result is divisible by prime(n), then M is also divisible by prime(n). This process may be repeated.
Values of a(n) can be quickly calculated by finding the smallest multiple of prime(n) which ends in a 1, and removing this last digit. E.g., 7 -> 21 -> 2, 11 -> 11 -> 1, 13 -> 91 -> 9, 17 -> 51 -> 5, 19 -> 171 -> 17.
a(n) is the canonical representative, in the interval (0, p), of the inverse of -10, modulo p = prime(n). - M. F. Hasler, Feb 03 2025

References

  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, page 76-81.

Crossrefs

Programs

  • Maple
    a:= n-> -1/10 mod ithprime(n):
    seq(a(n), n=4..69);  # Alois P. Heinz, Feb 03 2025
  • Mathematica
    a[n_] := Block[{p = Prime[n], k = 1}, While[ Mod[10k + 1, p] != 0, k++ ]; k]; Table[ a[n], {n, 4, 69}]
    PowerMod[-10, -1, Prime[Range[4, 100]]] (* Paolo Xausa, Feb 06 2025 *)
  • PARI
    vector(66,n, my(p=prime(n+3)); p-lift(Mod(10,p)^-1)) \\ Joerg Arndt, Jan 23 2023
    
  • PARI
    a(n)=lift(-1/Mod(10,prime(n)));
    apply(a, [4..66]) \\ M. F. Hasler, Feb 03 2025
  • Python
    import sympy
    [pow(-10, -1, p) for p in sympy.primerange(7,300)]
    # Nicholas Stefan Georgescu, Jan 17 2023
    

Formula

a(n) = p - (10 mod p)^(-1) where p = prime(n). - Joerg Arndt, Jan 23 2023

Extensions

Definition edited by M. F. Hasler, Feb 03 2025
Showing 1-2 of 2 results.