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

A243110 Records in A054471.

Original entry on oeis.org

3, 11, 37, 101, 239, 271, 1933, 3191, 3541, 4093, 4649, 9091, 21649, 52579, 123551, 210631, 238681, 329401, 333667, 513239, 909091, 2071723, 2906161, 5882353, 10838689, 35121409, 52986961, 70541929, 83251631, 99990001, 121499449, 247629013, 265371653, 1052788969, 1056689261, 1058313049, 5363222357
Offset: 1

Views

Author

Robert G. Wilson v, Aug 20 2014

Keywords

Crossrefs

Cf. A054471.

Programs

  • Mathematica
    p = 2; mx = 0; lst = {}; While[p < 12500000000, m = (p - 1)/MultiplicativeOrder[10, p]; If[m > mx, mx = m; AppendTo[lst, p]; Print[{m, p}]]; p = NextPrime@ p]; lst
  • Python
    from itertools import islice
    from sympy import nextprime, n_order
    def A243110_gen(): # generator of terms
        p, c = 5, 2
        yield 3
        while p:=nextprime(p):
            if p-1>c*(k:=n_order(10,p)):
                c = (p-1)//k
                yield int(p) # Chai Wah Wu, Jan 23 2024

A006556 Number of different cycles of digits in the decimal expansions of 1/p, 2/p, ..., (p-1)/p where p = n-th prime different from 2 or 5.

Original entry on oeis.org

2, 1, 5, 2, 1, 1, 1, 1, 2, 12, 8, 2, 1, 4, 1, 1, 2, 2, 9, 6, 2, 2, 1, 25, 3, 2, 1, 1, 3, 1, 17, 3, 1, 2, 2, 2, 1, 4, 1, 1, 2, 1, 2, 2, 7, 1, 2, 1, 1, 34, 8, 5, 1, 1, 1, 54, 4, 10, 2, 2, 2, 2, 1, 4, 3, 1, 2, 3, 11, 2, 1, 2, 1, 1, 1, 4, 2, 2, 1, 3, 2, 1, 2, 2, 14, 3, 1, 3, 2, 2, 1, 1, 1, 1, 1, 10, 2, 1, 6
Offset: 3

Views

Author

Keywords

Examples

			1/13=.0769230769..., 2/13=.1538461538..., 3/13= .2307692307..., etc., with 2 different cycles, so a(4) = 2 [13 is the 4th prime different from 2 or 5].
		

References

  • J. H. Conway and R. K. Guy, The Book of Numbers, Copernicus Press, NY, 1996, p. 162.
  • M. Kraitchik, Recherches sur la Théorie des Nombres. Gauthiers-Villars, Paris, Vol. 1, 1924, Vol. 2, 1929, see Vol. 1, p. 131.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A048595 and A002371 for the length of the cycles. See also A054471.

Programs

  • Mathematica
    Map[(# - 1)/MultiplicativeOrder[10, #] &, {3}~Join~Prime@ Range[4, 101]] (* Michael De Vlieger, May 27 2020 *)
  • PARI
    f(p) = (p-1)/znorder(Mod(10, p));
    lista(nn) = {my(vp=select(x->(10%x), primes(nn))); apply(f, vp);} \\ Michel Marcus, May 27 2020

Formula

(p-1)/x, where 10^x = 1 mod p.

Extensions

More terms from James Sellers, May 24 2000
Edited by Charles R Greathouse IV, Nov 01 2009

A055628 Primes p whose period of the reciprocal 1/p is (p-1)/3.

Original entry on oeis.org

103, 127, 139, 331, 349, 421, 457, 463, 607, 661, 673, 691, 739, 829, 967, 1657, 1669, 1699, 1753, 1993, 2011, 2131, 2287, 2647, 2659, 2749, 2953, 3217, 3229, 3583, 3691, 3697, 3739, 3793, 3823, 3931, 4273, 4297, 4513, 4549, 4657, 4903, 4909, 4993, 5011
Offset: 1

Views

Author

Don Willard (dwillard(AT)prairie.cc.il.us), Jun 05 2000

Keywords

Comments

Cyclic numbers of the third degree (or third order): the reciprocals of these numbers belong to one of three different cycles. Each cycle has (number-1)/3 digits.
All primes p except 2 or 5 have a reciprocal with period which divides p-1.

Examples

			127 has period 42 and (127-1)/3 = 126/3 = 42.
		

References

  • Stephen P. Richards, A Number For Your Thoughts, 1982, 1984, Box 501, New Providence, NJ, 07974, ISBN 0-9608224-0-2.

Crossrefs

Programs

  • Mathematica
    LP[ n_Integer ] := (ds = Divisors[ n - 1 ]; Take[ ds, Position[ PowerMod[ 10, ds, n ], 1 ][ [ 1, 1 ] ] ][ [ -1 ] ]); CL[ n_Integer ] := (n - 1)/LP[ n ]; Select[ Range[ 7, 7500 ], PrimeQ[ # ] && CL[ # ] == 3 & ]
    f[n_Integer] := Block[{ds = Divisors[n - 1]}, (n - 1)/Take[ ds, Position[ PowerMod[ 10, ds, n], 1] [[1, 1]]] [[ -1]]]; Select[ Prime[ Range[4, 700]], f[ # ] == 3 &] (* Robert G. Wilson v, Sep 14 2004 *)

Extensions

More terms from Robert G. Wilson v, Aug 02 2000
Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, May 27 2007

A072982 Primes p for which the period of 1/p is a power of 2.

Original entry on oeis.org

3, 11, 17, 73, 101, 137, 257, 353, 449, 641, 1409, 10753, 15361, 19841, 65537, 69857, 453377, 976193, 1514497, 5767169, 5882353, 6187457, 8253953, 8257537, 70254593, 167772161, 175636481, 302078977, 458924033, 639631361, 1265011073
Offset: 1

Views

Author

Benoit Cloitre, Jul 26 2002

Keywords

Comments

All Fermat primes > 5 (A019434) are in the sequence, since it can be shown that the period of 1/(2^(2^n)+1) is 2^(2^n) whenever 2^(2^n)+1 is prime. - Benoit Cloitre, Jun 13 2007
Take all the terms from row 2^k of triangle in A046107 for k >= 0 and sort to arrive at this sequence. - Ray Chandler, Nov 04 2011
Additional terms, but not necessarily the next in sequence: 13462517317633 has period 1048576 = 2^20; 46179488366593 has period 2199023255552 = 2^41; 101702694862849 has period 8388608 = 2^23; 171523813933057 has period 4398046511104 = 2^42; 505775348776961 has period 2199023255552 = 2^41; 834427406578561 has period 64 = 2^6 - Ray Chandler, Nov 09 2011
Furthermore (excluding the initial term 3) this sequence is also the ascending sequence of primes dividing 10^(2^k)+1 for some nonnegative integer k. For a prime dividing 10^(2^k)+1, the period of 1/p is 2^(k+1). Thus for the prime p = 558711876337536212257947750090161313464308422534640474631571587847325442162307811\
65223702155223678309562822667655169, a factor of 10^(2^7)+1, the period of 1/p is only 2^8. This large prime then also belongs to the sequence. - Christopher J. Smyth, Mar 13 2014
For any m, every term that is not a factor of 10^(2^k)-1 for some k < m is congruent to 1 (mod 2^m). Thus all terms except 3, 11, 17, 73, 101, 137, 353, 449, 69857, 976193, 5882353, 6187457 are congruent to 1 (mod 128). - Robert Israel, Jun 17 2016
Additional terms listed earlier confirmed as next terms in sequence. - Arkadiusz Wesolowski, Jun 17 2016

Examples

			15361 has a period of 256 = 2^8, hence 15361 is in the sequence.
		

Crossrefs

Cf. A197224 (power of 2 which is the period of the decimal 1/a(n)).

Programs

  • Maple
    filter:= proc(p) local k;
      if not isprime(p) then return false fi;
      k:=igcd(p-1,2^ilog2(p));
      evalb(10 &^ k mod p = 1)
    end proc:
    r:= select(`<=`,`union`(seq(numtheory:-factorset(10^(2^k)-1),k=1..6)),10^9):
    b:= select(filter, {seq(i,i=129..10^9,128)}):
    sort(convert(r union b, list)); # Robert Israel, Jun 17 2016
  • Mathematica
    Do[ If[ IntegerQ[ Log[2, Length[ RealDigits[ 1/Prime[n]] [[1, 1]]]]], Print[ Prime[n]]], {n, 1, 47500}] (* Robert G. Wilson v, May 09 2007 *)
    pmax = 10^10; p = 1; While[p < pmax,p = NextPrime[p];If[ IntegerQ[Log[2, MultiplicativeOrder[10, p] ] ], Print[ p];];]; (* Ray Chandler, May 14 2007 *)
  • PARI
    select( {is_A072982(p)=if(p>5, 1<M. F. Hasler, Nov 18 2024
    
  • Python
    from itertools import count, islice
    from sympy import prime, n_order
    def A072982_gen(): return (p for p in (prime(n) for n in count(2)) if p != 5 and bin(n_order(10,p))[2:].rstrip('0') == '1')
    A072982_list = list(islice(A072982_gen(),10)) # Chai Wah Wu, Feb 07 2022
    
  • Python
    from sympy import primerange, n_order
    A072982_upto = lambda N=1e5: [p for p in primerange(3, N) if p != 5 and n_order(10, p).bit_count() == 1] # or (...) to get a generator. - M. F. Hasler, Nov 19 2024

Extensions

Edited by Robert G. Wilson v, Aug 20 2002
a(18) from Ray Chandler, May 02 2007
a(19) from Robert G. Wilson v, May 09 2007
a(20)-a(32) from Ray Chandler, May 14 2007
Deleted an unsatisfactory PARI program. - N. J. A. Sloane, Nov 19 2024

A101208 Smallest odd prime p such that n = (p - 1) / ord_p(2).

Original entry on oeis.org

3, 7, 43, 113, 251, 31, 1163, 73, 397, 151, 331, 1753, 4421, 631, 3061, 257, 1429, 127, 6043, 3121, 29611, 1321, 18539, 601, 15451, 14327, 2971, 2857, 72269, 3391, 683, 2593, 17029, 2687, 42701, 11161, 13099, 1103, 71293, 13121, 17467, 2143, 83077, 25609, 5581
Offset: 1

Views

Author

Leigh Ellison (le(AT)maths.gla.ac.uk), Dec 14 2004

Keywords

Comments

First time n appears is given in A001917.
Smallest p (let it be the k-th prime) such that A001917(k) = n, or the smallest prime which has ratio n in base 2.
First cyclic number (in base 2) of n-th degree (or n-th order): the reciprocals of these numbers belong to one of n different cycles. Each cycle has (a(n) - 1)/n digits.
Conjecture: a(n) is defined for all n.
Recursive by indices: (See A054471)
1, 3, 43, 83077, ...
2, 7, 1163, ...
4, 113, 257189, ...
5, 251, 6846277, ...
6, 31, 683, ...
8, 73, 472019, ...
9, 397, 13619483, ...
10, 151, 349717, ...
...
The records for the ratio in base 2 are: 1, 2, 6, 8, 18, 24, 31, 38, 72, 105, 129, 630, 1285, 1542, 2048, ..., the primes are: 3, 7, 31, 73, 127, 601, 683, 1103, 1801, 2731, 5419, 8191, 43691, 61681, 65537, ...
(Updated by Eric Chen, Jun 01 2015)

Crossrefs

Cf. A001122, A115591, A001133, A001134, A001135, A001136, A152307, A152308, A152309, A152310, A152311, which are sequences of primes p where the period of the reciprocal in base 2 is (p-1)/n for n=1 to 11.

Programs

  • Mathematica
    f[n_Integer] := Block[{k = 1, p}, While[p = k*n + 1; ! PrimeQ[p] || p != 1 + n*MultiplicativeOrder[2, p] || p = 2, k++]; p]; Array[f, 128] (* Eric Chen, Jun 01 2015 *)
  • PARI
    a(n) = {p=3; ok = 0; until(ok, if (n == (p-1)/znorder(Mod(2, p)), ok = 1, p = nextprime(p+1));); return (p);} \\ Michel Marcus, Jun 27 2013

A372797 Smallest prime p such that the multiplicative order of 4 modulo p is 2*n, or 0 if no such prime exists.

Original entry on oeis.org

3, 17, 31, 73, 151, 433, 631, 337, 127, 241, 331, 601, 4421, 673, 3061, 257, 1429, 1657, 1103, 3121, 2143, 1321, 18539, 1777, 2351, 37441, 2971, 2857, 3191, 17401, 683, 15809, 17029, 9929, 38431, 1801, 11471, 63689, 49999, 13121, 17467, 21169, 83077, 25609, 5581, 5153, 26227
Offset: 1

Views

Author

Jianing Song, May 13 2024

Keywords

Comments

First prime p such that the expansion of 1/p has period (p-1)/(2*n) in base 4. Also the first prime p such that {k/p : 1 <= k <= p-1} has 2*n different cycles when written out in base 4.
Since ord(a^m,k) = ord(a,k)/gcd(m,ord(a,k)) for gcd(a,k) = 1, we have that (p-1)/ord(4,p) = ((p-1)/ord(2,p)) * gcd(2,ord(2,p)) is always even. Here ord(a,k) is the multiplicative order of a modulo k.

Examples

			In the following examples let () denote the reptend. The prime numbers themselves and the fractions are written out in decimal.
The base-4 expansion of 1/3 is 0.(1), so the reptend has length 1 = (3-1)/2. Also, the base-4 expansions of 1/3 = 0.(1) and 2/3 = 0.(2) have two cycles 1 and 2. 3 is the smallest such prime, so a(1) = 3.
The base-4 expansion of 1/17 is 0.(0033), so the reptend has length 4 = (17-1)/4. Also, the base-4 expansions of 1/17, 2/17, ..., 16/17 have four cycles 0033, 0132, 1023 and 1122. 17 is the smallest such prime, so a(2) = 17.
The base-4 expansion of 1/31 is 0.(00133), so the reptend has length 5 = (31-1)/6. Also, the base-4 expansions of 1/31, 2/31, ..., 30/31 have three cycles 00201, 01203, 02211, 03213, 11223 and 13233. 13 is the smallest such prime, so a(3) = 13.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = For[p = 2, True, p = NextPrime[p], If[MultiplicativeOrder[4, p] == (p-1)/(2n), Return[p]]];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* Jean-François Alcover, Nov 24 2024 *)
  • PARI
    a(n,{base=4}) = forprime(p=2, oo, if((base%p) && znorder(Mod(base,p)) == (p-1)/(n * if(issquare(base), 2, 1)), return(p)))

A372798 Smallest prime p such that the multiplicative order of 8 modulo p is n, or 0 if no such prime exists.

Original entry on oeis.org

3, 17, 13, 113, 251, 7, 1163, 89, 109, 431, 1013, 577, 4421, 953, 571, 257, 4523, 127, 15467, 3761, 3109, 7151, 18539, 73, 25301, 14327, 2971, 42953, 72269, 151, 683, 12641, 331, 2687, 42701, 5113, 18797, 1103, 8581, 13121, 172283, 631, 221021, 120737, 3061, 5153, 217517
Offset: 1

Views

Author

Jianing Song, May 13 2024

Keywords

Comments

First prime p such that the expansion of 1/p has period (p-1)/n in base 8. Also the first prime p such that {k/p : 1 <= k <= p-1} has n different cycles when written out in base 8.

Examples

			In the following examples let () denote the reptend. The prime numbers themselves and the fractions are written out in decimal.
The base-8 expansion of 1/3 is 0.(25), so the reptend has length 2 = (3-1)/1. Also, the base-8 expansions of 1/3 = 0.(25) and 2/3 = 0.(52) have only one cycle 25. 3 is the smallest such prime, so a(1) = 3.
The base-8 expansion of 1/17 is 0.(03607417), so the reptend has length 8 = (17-1)/2. Also, the base-8 expansions of 1/17, 2/17, ..., 16/17 have two cycles 03607417 and 13226455. 17 is the smallest such prime, so a(2) = 17.
The base-8 expansion of 1/13 is 0.(0473), so the reptend has length 4 = (13-1)/3. Also, the base-8 expansions of 1/13, 2/13, ..., 12/13 have three cycles 0473, 1166 and 2354. 13 is the smallest such prime, so a(3) = 13.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = For[p = 2, True, p = NextPrime[p], If[MultiplicativeOrder[8, p] == (p-1)/n, Return[p]]];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* Jean-François Alcover, Nov 24 2024 *)
  • PARI
    a(n,{base=8}) = forprime(p=2, oo, if((base%p) && znorder(Mod(base,p)) == (p-1)/(n * if(issquare(base), 2, 1)), return(p)))

A372799 Smallest prime p such that the multiplicative order of 9 modulo p is 2*n, or 0 if no such prime exists.

Original entry on oeis.org

5, 13, 67, 313, 41, 61, 883, 433, 271, 2161, 683, 193, 1223, 8317, 2131, 769, 2551, 1621, 8513, 2521, 8779, 4357, 5843, 3889, 7451, 16069, 3079, 19993, 14327, 661, 23747, 95617, 42703, 2857, 15401, 17209, 2887, 7297, 547, 13441, 4019, 757, 41453, 29833, 54631, 31741, 20399
Offset: 1

Views

Author

Jianing Song, May 13 2024

Keywords

Comments

First prime p such that the expansion of 1/p has period (p-1)/(2*n) in base 9. Also the first prime p such that {k/p : 1 <= k <= p-1} has 2*n different cycles when written out in base 9.
Since ord(a^m,k) = ord(a,k)/gcd(m,ord(a,k)) for gcd(a,k) = 1, we have that (p-1)/ord(9,p) = ((p-1)/ord(3,p)) * gcd(2,ord(3,p)) is always even. Here ord(a,k) is the multiplicative order of a modulo k.

Examples

			In the following examples let () denote the reptend. The prime numbers themselves and the fractions are written out in decimal.
The base-9 expansion of 1/5 is 0.(17), so the reptend has length 2 = (5-1)/2. Also, the base-9 expansions of 1/5 = 0.(17), 2/5 = (0.35), 3/5 = 0.(53) and 4/5 = 0.(71) have two cycles 17 and 35. 5 is the smallest such prime, so a(1) = 5.
The base-9 expansion of 1/13 is 0.(062), so the reptend has length 3 = (13-1)/4. Also, the base-9 expansions of 1/13, 2/13, ..., 12/13 have four cycles 062, 134, 268 and 475. 13 is the smallest such prime, so a(2) = 13.
The base-9 expansion of 1/67 is 0.(01178285332), so the reptend has length 11 = (67-1)/6. Also, the base-9 expansions of 1/67, 2/67, ..., 66/67 have six cycles 01178285332, 02367581664, 03556877106, 04746273438, 07224865213 and 08414261545. 67 is the smallest such prime, so a(3) = 67.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = For[p = 2, True, p = NextPrime[p], If[MultiplicativeOrder[9, p] == (p-1)/(2n), Return[p]]];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* Jean-François Alcover, Nov 24 2024 *)
  • PARI
    a(n,{base=9}) = forprime(p=2, oo, if((base%p) && znorder(Mod(base,p)) == (p-1)/(n * if(issquare(base), 2, 1)), return(p)))

A372800 Smallest prime p such that the multiplicative order of 16 modulo p is 2*n, or 0 if no such prime exists.

Original entry on oeis.org

3, 5, 31, 17, 151, 109, 631, 113, 127, 1181, 331, 433, 13963, 1709, 3331, 1217, 2687, 397, 1103, 241, 2143, 1013, 18539, 1777, 2351, 4421, 2971, 673, 3191, 3061, 683, 257, 58147, 1429, 38431, 1657, 11471, 22573, 49999, 3121, 17467, 33013, 252583, 1321, 23671, 51797, 26227, 4513
Offset: 1

Views

Author

Jianing Song, May 13 2024

Keywords

Comments

First prime p such that the expansion of 1/p has period (p-1)/(2*n) in base 16. Also the first prime p such that {k/p : 1 <= k <= p-1} has 2*n different cycles when written out in base 16.
Since ord(a^m,k) = ord(a,k)/gcd(m,ord(a,k)) for gcd(a,k) = 1, we have that (p-1)/ord(16,p) = ((p-1)/ord(2,p)) * gcd(4,ord(2,p)) is always even. Here ord(a,k) is the multiplicative order of a modulo k.

Examples

			In the following examples let () denote the reptend. The prime numbers themselves and the fractions are written out in decimal.
The base-16 expansion of 1/3 is 0.(5), so the reptend has length 1 = (3-1)/2. Also, the base-16 expansions of 1/3 = 0.(5) and 2/3 = 0.(A) have two cycles 5 and A. 3 is the smallest such prime, so a(1) = 3.
The base-16 expansion of 1/5 is 0.(3), so the reptend has length 1 = (5-1)/4. Also, the base-16 expansions of 1/5 = 0.(3), 2/5 = (0.6), 3/5 = 0.(9) and 4/5 = 0.(C) have four cycles 3, 6, 9 and A. 5 is the smallest such prime, so a(2) = 5.
The base-16 expansion of 1/31 is 0.(08421), so the reptend has length 5 = (31-1)/6. Also, the base-16 expansions of 1/31, 2/31, ..., 30/31 have six cycles 08421, 18C63, 294A5, 39CE7, 5AD6B and 7BDEF. 31 is the smallest such prime, so a(3) = 31.
		

Crossrefs

Cf. A372801.

Programs

  • Mathematica
    a[n_] := a[n] = For[p = 2, True, p = NextPrime[p], If[MultiplicativeOrder[16, p] == (p-1)/(2n), Return[p]]];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 100}] (* Jean-François Alcover, Nov 24 2024 *)
  • PARI
    a(n,{base=16}) = forprime(p=2, oo, if((base%p) && znorder(Mod(base,p)) == (p-1)/(n * if(issquare(base), 2, 1)), return(p)))

A154470 Rewriting function for Wolfram's e[x_][y_] -> x[x[y]] symbolic system transformation, implemented on nihilistic S-expressions (parenthesizations) encoded by A014486.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 11 2009

Keywords

Comments

Here we use the empty list () as a marker for symbol 'e'. Any sublist like (... ()(x1 x2 ... xn)(y1 y2 ... yn) ...) is transformed into the form (... x1 x2 ... xn (x1 x2 ... xn (y1 y2 ... yn)) ...). A054471 gives the iterations of this function, starting from initial value 31706.

Crossrefs

Cf. A014486.
Differs from A001477 for the first time at n=29, where a(n)=32.

Programs

  • Scheme
    (define (*A154470 s) (cond ((null? s) s) ((and (null? (car s)) (>= (length s) 3) (pair? (second s)) (pair? (third s))) (append (second s) (cons (append (second s) (list (third s))) (*A154470 (cdddr s))))) (else (cons (*A154470 (car s)) (*A154470 (cdr s))))))
Showing 1-10 of 11 results. Next