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

A326610 Least k such that A000790(k) = A108574(n).

Original entry on oeis.org

0, 3, 26, 11, 14, 59, 83, 23, 443, 338, 263, 578, 38, 662, 47, 227, 3467, 1823, 842, 4898, 983, 4622, 4847, 2747, 4127, 11567, 347, 542, 17483, 2867, 22367, 43067, 18527, 5042, 5063, 12422, 66047, 2858, 87302, 11702, 11147, 3062, 24602, 158, 94763, 247838, 1202
Offset: 1

Views

Author

Richard N. Smith, Jul 14 2019

Keywords

Comments

The largest term is a(106) = 10009487 (for the primary pretender 453).

Crossrefs

A000790 Primary pretenders: least composite c such that n^c == n (mod c).

Original entry on oeis.org

4, 4, 341, 6, 4, 4, 6, 6, 4, 4, 6, 10, 4, 4, 14, 6, 4, 4, 6, 6, 4, 4, 6, 22, 4, 4, 9, 6, 4, 4, 6, 6, 4, 4, 6, 9, 4, 4, 38, 6, 4, 4, 6, 6, 4, 4, 6, 46, 4, 4, 10, 6, 4, 4, 6, 6, 4, 4, 6, 15, 4, 4, 9, 6, 4, 4, 6, 6, 4, 4, 6, 9, 4, 4, 15, 6, 4, 4, 6, 6, 4, 4, 6, 21, 4, 4, 10, 6, 4
Offset: 0

Views

Author

Keywords

Comments

It is remarkable that this sequence is periodic with period 19568584333460072587245340037736278982017213829337604336734362\ 294738647777395483196097971852999259921329236506842360439300 = 2^2 * 3^2 * 5^2 * 7^2 * 11^2 * 13^2 * 17^2 * 19^2 * 23^2 * 29 * 31 * 37 * 41 * 43 * 47 * 53 * 59 * 61 * 67 * 71 * 73 * 79 * 83 * 89 * 97 * 101 * 103 * 107 * 109 * 113 * 127 * 131 * 137 * 139 * 149 * 151 * 157 * 163 * 167 * 173 * 179 * 181 * 191 * 193 * 197 * 199 * 211 * 223 * 227 * 229 * 233 * 239 * 241 * 251 * 257 * 263 * 269 * 271 * 277.
Note that the period is 277# * 23# (where as usual # is the primorial). - Charles R Greathouse IV, Feb 23 2014
Records are 4, 341, 382 & 561, and they occur at indices of 0, 2, 383 & 10103. - Robert G. Wilson v, Feb 22 2014
Andrzej Schinzel (1961) proved that a(n) > 6 if and only if n == {2, 11} (mod 12). - Thomas Ordowski and Krzysztof Ziemak, Jan 21 2018
We have a(n) <= A090086(n), with equality iff gcd(a(n),n) = 1. - Thomas Ordowski, Feb 13 2018
Sequence b(n) = gcd(a(n), n) is also periodic with period P = 23# * 277#, because this is the LCM of all terms, cf. A108574. - M. F. Hasler, Feb 16 2018

Examples

			a(2) = 341 because 2^341 == 2 (mod 341) and there is no smaller composite number c such that 2^c == 2 (mod c).
a(3) = 6 because 3^6 == 3 (mod 6) (whereas 3^4 == 1 (mod 4)).
		

Crossrefs

Cf. A108574 (all values occurring in this sequence).
Cf. A002808, A090086, A295997 (it has the same set of distinct terms).

Programs

  • Haskell
    import Math.NumberTheory.Moduli (powerMod)
    a000790 n = head [c | c <- a002808_list, powerMod n c c == mod n c]
    -- Reinhard Zumkeller, Jul 11 2014
    
  • Maple
    f:= proc(n) local c;
      for c from 4 do
        if not isprime(c) and n &^ c - n mod c = 0 then return c fi
      od
    end proc:
    map(f, [$0..100]); # Robert Israel, Jan 21 2018
  • Mathematica
    a[n_] := For[c = 4, True, c = If[PrimeQ[c + 1], c + 2, c + 1], If[PowerMod[n, c, c] == Mod[n, c], Return[c]]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Oct 18 2013 *)
  • PARI
    a(n)=forcomposite(c=4,554,if(Mod(n,c)^c==n,return(c))); 561 \\ Charles R Greathouse IV, Feb 23 2014
    
  • Python
    from sympy import isprime
    def A000790(n):
        c = 4
        while pow(n,c,c) != (n % c) or isprime(c):
            c += 1
        return c # Chai Wah Wu, Apr 02 2021

A295997 Least composite k such that d^k == d (mod k) for every divisor d of n.

Original entry on oeis.org

4, 341, 6, 341, 4, 561, 6, 341, 6, 561, 10, 561, 4, 561, 561, 341, 4, 561, 6, 561, 6, 561, 22, 561, 4, 561, 6, 561, 4, 561, 6, 341, 561, 561, 561, 561, 4, 561, 6, 561, 4, 561, 6, 561, 561, 341, 46, 561, 6, 561, 91, 561, 4, 561, 10, 561, 6, 341, 15, 561, 4, 341
Offset: 1

Views

Author

Thomas Ordowski, Feb 14 2018

Keywords

Comments

a(n) is the smallest weak pseudoprime k to all natural bases d|n.
For n > 1, a(n) is the smallest composite k such that p^k == p (mod k) for every prime p dividing n; so a(n) is the smallest weak pseudoprime k to all prime bases p|n (thus it is enough to check this congruence only for all prime divisors p of n, see the second program in PARI).
For n > 1, a(n) = 4 iff n has all prime divisors p == 1 (mod 4).
The sequence is bounded, namely 4 <= a(n) <= 561, see A002997.
All members of A108574 appear in the sequence. The last to appear is 538 = a(8110351). - Robert Israel, Feb 15 2018
Conjecture: all distinct terms of the sequence are A108574. - Robert Israel and Thomas Ordowski, Feb 16 2018. The conjecture is true and can be established computationally, like in Conway-Guy-Schneeberger-Sloane (1997) paper. - Max Alekseyev, Feb 27 2018
Note that a(n) >= A000790(n). - Thomas Ordowski, Feb 16 2018
The sequence is not eventually periodic: e.g., any arithmetic progression contains infinitely many terms divisible by a prime == 3 (mod 4), and thus with a(n) > 4, while on the other hand there are infinitely many terms with a(n) = 4. - Robert Israel, Feb 16 2018

Crossrefs

Programs

  • Maple
    f := n -> g(map(t -> t[1], ifactors(n)[2])):
    g:= proc (P) local k; option remember;
      for k from 4 do
        if not isprime(k) and andmap(p -> (p &^ k - p mod k = 0), P)
        then return k
        end if
      end do
    end proc:
    map(f, [$1..100]); # Robert Israel, Feb 14 2018
  • Mathematica
    With[{c = Table[FixedPoint[n + PrimePi@ # + 1 &, n + PrimePi@ n + 1], {n, 561}]}, Table[With[{d = Divisors@ n}, SelectFirst[c, Function[k, AllTrue[d, PowerMod[#, k, k] == Mod[#, k] &]]]], {n, 62}]] (* Michael De Vlieger, Feb 17 2018, after Robert G. Wilson v at A066277 *)
  • PARI
    a(n) = forcomposite(k=1,, my (ok=1); fordiv (n, d, if (Mod(d,k)!=Mod(d,k)^k, ok=0; break)); if (ok, return (k))); \\ Rémy Sigrist, Feb 14 2018
    
  • PARI
    a(n)=my(f=factor(n)[,1],p); forcomposite(k=4,561, for(i=1,#f, p=f[i]; if(Mod(p,k)^k!=p, next(2))); return(k)); \\ Charles R Greathouse IV, Feb 14 2018

Formula

a(n) = a(rad(n)), where rad(n) = A007947(n).
For prime p, a(p) = A000790(p). - Max Alekseyev, Feb 27 2018

Extensions

More terms from Rémy Sigrist, Feb 14 2018

A309316 Euler primary pretenders: a(n) is the smallest odd composite k such that n^((k+1)/2) == +-n (mod k).

Original entry on oeis.org

9, 9, 341, 121, 341, 15, 15, 21, 9, 9, 9, 33, 33, 21, 15, 15, 15, 9, 9, 9, 15, 15, 21, 33, 15, 15, 9, 9, 9, 15, 15, 15, 25, 33, 21, 9, 9, 9, 39, 15, 15, 21, 21, 21, 9, 9, 9, 65, 21, 21, 15, 15, 39, 9, 9, 9, 21, 21, 57, 15, 15, 15, 9, 9, 9, 15, 15, 33, 25, 15, 15, 9, 9, 9, 15, 15, 15, 21, 21, 39, 9, 9, 9
Offset: 0

Views

Author

Thomas Ordowski, Jul 23 2019

Keywords

Comments

Note that if p is an odd prime, then n^((p+1)/2) == +-n (mod p) for all n.
a(n) is the least Euler weak pseudoprime to base n, as A000790(n) is the least Fermat weak pseudoprime to base n.
This sequence is bounded, namely a(n) <= 1729, the smallest absolute Euler pseudoprime, because n^((1729+1)/2) == n (mod 1729) for every n, see A033181.
The set A = {a(n)} of terms contains all odd semiprimes pq < 1729 such that p-1 | q-1. Other numbers in the set are 561, 645, 1065, 1247, and 1729. Probably complete. Cf. A108574.
This sequence is periodic with a very long period P = LCM(A) = p#*q#/2^2, where p and q are the largest primes such that p^2 < 1729 and 3q < 1729. Such primes are p = 41 and q = 571, so the period P = 41#*571#/4 (248 digits) is much longer than period of the (Fermat) primary pretenders.
Problem: is P the fundamental period of this sequence?
Records of a(n) are 9, 341, 561, 703, 793, 1145, 1263, 1477, and 1729; for n = 0, 2, 383, 1822, 3308, 4702, 10103, 12252, and 21821. - Amiram Eldar, Jul 24 2019

Examples

			a(2) = 341 since 2^((341+1)/2) = 2^171 == 2 (mod 341) and 341 is the smallest odd composite number satisfying this congruence.
a(5) = 15 since 5^((15+1)/2) = 5^8 == -5 (mod 15) and 15 is the smallest odd composite number with this property.
a(8) = 9 since 8^((9+1)/2) = 8^5 == 8 (mod 9) and 9 is the smallest odd composite number.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k,r;
      for k from 9 by 2 do
        if isprime(k) then next fi;
        r:= n &^ ((k+1)/2) mod k;
        if r = (n mod k) or r = (-n mod k) then return k fi
      od
    end proc:
    map(f, [$0..100]); # Robert Israel, Jul 23 2019
  • Mathematica
    a[n_] := Module[{k=9}, While[!CompositeQ[k] || ((m = PowerMod[n, (k+1)/2, k]) != Mod[n, k] && m != Mod[-n, k]), k+=2]; k]; Array[a, 100, 0] (* Amiram Eldar, Jul 23 2019 *)

Formula

a(n) = 9 if and only if n == {-1,0,1} (mod 9).
a(n + P) = a(n), where the period P = 41#*571#/4.

Extensions

More terms from Amiram Eldar, Jul 23 2019

A321575 Nexus primary pretenders: a(n) is the smallest composite k such that n^k - (n-1)^k == 1 (mod k).

Original entry on oeis.org

9, 4, 341, 4, 6, 4, 9, 4, 14, 4, 6, 4, 9, 4, 21, 4, 6, 4, 9, 4, 15, 4, 6, 4, 9, 4, 10, 4, 6, 4, 9, 4, 62, 4, 6, 4, 9, 4, 49, 4, 6, 4, 9, 4, 33, 4, 6, 4, 9, 4, 14, 4, 6, 4, 9, 4, 10, 4, 6, 4, 9, 4, 65, 4, 6, 4, 9, 4, 49, 4, 6, 4, 9, 4, 111, 4, 6, 4, 9, 4, 15
Offset: 0

Views

Author

Thomas Ordowski, Nov 13 2018

Keywords

Comments

The sequence is bounded, namely a(n) <= 561 (the smallest Carmichael number), since if n^k == n (mod k) and (n-1)^k == n-1 (mod k), then n^k - (n-1)^k == 1 (mod k).
Problem: find all distinct terms of the sequence. Is this sequence periodic like the primary pretenders?
Note that a(n) > 9 if and only if n == 2 (mod 6). We have a(6m+2) = 341, 14, 21, 15, 10, 62, 49, 33, 14, 10, 65, 49, 111, 15, 10, ... for m >= 0. Found a(n) = 561 for the smallest n = 6*70+2 = 422.
From Robert Israel, Nov 27 2018: (Start)
Since a(n) depends only on the residues of n mod k for composites k <= 561, it must be periodic with period at most the lcm of those composites.
Up to n=2*10^6, the last term to appear for the first time is 478 = a(184748).
Conjecture: the only terms of the sequence that are not squarefree are 4, 9 and 49. (End)

Crossrefs

Programs

  • Maple
    Comps:= remove(isprime, [$4..561]):
    f:= proc(n) local k;
      for k in Comps do if n&^k - (n-1)&^k - 1 mod k = 0 then return k fi od
    end proc:
    map(f, [$0..100]); # Robert Israel, Nov 27 2018
  • Mathematica
    a[n_]:=Module[{k=4}, While[PrimeQ[k] || Mod[n^k-(n-1)^k,k]!=1, k++]; k]; Array[a, 100, 0] (* Amiram Eldar, Nov 13 2018 *)
  • PARI
    a(n)=forcomposite(k=4,,Mod(n,k)^k-Mod(n-1,k)^k==1&&return(k)) \\ M. F. Hasler, Nov 13 2018

Formula

a(n) = 4 iff n == 1,3,5 (mod 6), thus n is odd.
a(n) = 6 iff n == 4 (mod 6).
a(n) = 9 iff n == 0 (mod 6).

Extensions

More terms from Amiram Eldar, Nov 13 2018
Showing 1-5 of 5 results.