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.

A141710 Least prime factor of n-th Carmichael number A002997(n).

Original entry on oeis.org

3, 5, 7, 5, 7, 7, 7, 5, 7, 13, 7, 13, 7, 3, 7, 11, 7, 13, 7, 17, 7, 7, 41, 5, 37, 13, 19, 13, 31, 41, 5, 37, 31, 13, 13, 3, 11, 7, 7, 5, 7, 11, 7, 19, 7, 5, 7, 43, 31, 37, 17, 23, 7, 31, 41, 11, 19, 17, 13, 53, 5, 7, 11, 43, 13, 5, 29, 5, 101, 53, 7, 13, 11, 7, 19, 31, 41, 13, 29, 31, 5
Offset: 1

Views

Author

M. F. Hasler, Jul 01 2008

Keywords

Comments

All terms of this sequence are odd primes. See A002997 for references.

Examples

			a(1)=3 since A002997(1)=3*11*17.
		

Crossrefs

Programs

  • Mathematica
    CarmichaelQ[n_] := Not[PrimeQ[n]] && Divisible[n - 1, CarmichaelLambda[n]]; FactorInteger[#][[1, 1]]& /@ Select[Range[4, 10^7], CarmichaelQ] (* Jean-François Alcover, Sep 23 2011 *)
  • PARI
    A141710(n)=vecmin(factor(A002997(n))[,1]) /* where A002997(n) can be defined as follows: */ system("wget b002997.txt; sed -e 's/^[0-9]*//' b002997.gp"); A2997=readvec("b002997.gp"); A002997(n)=A2997[n]; \

Formula

a(n) = A020639(A002997(n))

A283715 a(n) is the number of Carmichael numbers whose largest prime factor is prime(n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 2, 1, 0, 1, 2, 2, 2, 0, 0, 0, 0, 6, 3, 1, 9, 2, 0, 3, 9, 7, 3, 1, 16, 20, 42, 19, 12, 15, 3, 60, 54, 57, 2, 8, 2, 277, 20, 170, 75, 259, 775, 57, 11, 110
Offset: 1

Views

Author

Giovanni Resta, Mar 15 2017

Keywords

Comments

Since Carmichael numbers are squarefree, there is only a finite number of them whose largest prime factor is any given prime.

Examples

			a(28) = 1 because prime(28) = 107 and there is only one Carmichael number whose largest prime factor is 107, namely 413631505 = 5 * 7 * 17 * 73 * 89 * 107.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = If[n < 6, 0, Block[{t, p = Prime@ n}, Length@ Select[ Subsets[ Prime@ Range[2, n-1], {2, n-2}], (t = Times @@ #; Mod[t-1, p-1] == 0 && And @@ IntegerQ /@ ((p t - 1)/ (#-1))) &]]]; Array[a, 22]
  • Python
    from math import prod
    from itertools import combinations
    from sympy import prime, primerange
    def A283715(n):
        plist, c = list(primerange(3,p:=prime(n))), 0
        for l in range(2,len(plist)+1):
            for q in combinations(plist,l):
                k = prod(q)*p-1
                if not (k%(p-1) or any(k%(r-1) for r in q)):
                    c+=1
        return c # Chai Wah Wu, Sep 25 2024

Extensions

a(42)-a(50) from Ondrej Kutal, Sep 29 2024

A280617 Number of n-smooth Carmichael numbers.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 16, 16, 16, 16, 16, 16, 19, 19, 19, 19, 20, 20, 29, 29, 29, 29, 29, 29, 31, 31, 31, 31, 31, 31, 31, 31
Offset: 1

Views

Author

Michal Radwanski, Jan 06 2017

Keywords

Comments

A number is b-smooth whenever its prime factors are all not greater than b.
By Korselt's criterion, every Carmichael number is squarefree, therefore n-smooth numbers are products of subsets of primes below n.

Examples

			For n = 19, the n-smooth Carmichael numbers are
  571 = 3*11*17
  1105 = 5*13*17
  1729 = 7*13*19
There are no other Carmichael numbers that are 19-smooth, therefore a(19)=3.
		

Crossrefs

Programs

  • Maple
    extend:= proc(c,p)
         if andmap(q -> (p-1 mod q <> 0), c) then (c, c union {p}) else c fi
    end proc:
    carm:= proc(c) local n;
      n:= convert(c,`*`);
      map(t -> n-1 mod (t-1), c) = {0}
    end proc:
    A[1]:= 0: A[2]:= 0: Primes:= []:
    for k from 3 to 100 do
      A[k]:= A[k-1];
      if isprime(k) then
        Cands:= {{}};
        for i from 1 to nops(Primes) do
          if (k - 1) mod Primes[i] <> 0 then
            Cands:= map(extend,Cands,Primes[i])
          fi;
        od;
        Cands:= map(`union`,select(c -> nops(c) > 1, Cands),{k});
        A[k]:= A[k] + nops(select(carm,Cands));
        Primes:= [op(Primes),k];
      fi
    od:
    seq(A[i],i=1..100); # Robert Israel, Mar 14 2017
  • Mathematica
    a[n_] := a[n] = If[n<17, 0, a[n-1] + If[! PrimeQ[n], 0, Block[{t, k = PrimePi@n, p}, p = Prime@k; Length@ Select[ Subsets[ Prime@ Range[2, k-1], {2, k-2}], (t = Times @@ #; Mod[t-1, p-1] == 0 && And @@ IntegerQ /@ ((p t - 1)/ (#-1))) &]]]]; Array[a, 80] (* Giovanni Resta, Mar 14 2017 *)
  • Python
    from collections import Counter
    from functools import reduce
    from itertools import combinations, chain
    from operator import mul
    # http://www.sympy.org
    import sympy as sp
    limit = 90
    # credit: http://stackoverflow.com/a/16915734
    # as proved, there are no Carmichael numbers with
    # less than 3 prime factors, and thus modification
    def powerset(iterable):
        xs = list(iterable)
        return chain.from_iterable(combinations(xs, n) for n in range(3, len(xs) + 1))
    # all computed numbers will be limit-smooth
    def carmichael(limit):
        for d in powerset(sp.primerange(3, limit)):
            n = reduce(mul, d, 1)
            broke = False
            for p in d:
                if (n - 1) % (p - 1) != 0:
                    broke = True
                    break
            if not broke:
                yield (d[-1])
    # from list of pairs of (n, number_of_integers_with_n_as_greatest_prime_factor)
    # creates the sequence
    def prefix(lst):
        r = []
        s = 0
        rpointer = 0
        lstpointer = 0
        while lstpointer < len(lst):
            while lst[lstpointer][0] > rpointer:
                r.append(s)
                rpointer += 1
            s += lst[lstpointer][1]
            lstpointer += 1
        r.append(s + lst[-1][1])
        return r
    c = Counter(carmichael(limit))
    for i, e in enumerate(prefix(sorted(c.items()))):
        if i > 0:
            print(e, end=", ")
    
  • Python
    from math import prod
    from itertools import combinations
    from sympy import primerange
    def A280617(n):
        plist, c = list(primerange(3,n+1)), 0
        for l in range(2,len(plist)+1):
            for q in combinations(plist,l):
                k = prod(q)-1
                if not any(k%(r-1) for r in q):
                    c+=1
        return c # Chai Wah Wu, Sep 25 2024

Formula

a(n) = Sum_{k=1..primepi(n)} A283715(k). - Ondrej Kutal, Sep 27 2024

A298701 Irregular triangle read by rows in which row n lists the prime factors of the n-th Carmichael number.

Original entry on oeis.org

3, 11, 17, 5, 13, 17, 7, 13, 19, 5, 17, 29, 7, 13, 31, 7, 23, 41, 7, 19, 67, 5, 29, 73, 7, 31, 73, 13, 37, 61, 7, 11, 13, 41, 13, 37, 97, 7, 73, 103, 3, 5, 47, 89, 7, 13, 19, 37, 11, 13, 17, 31, 7, 11, 13, 101, 13, 37, 241, 7, 13, 19, 73, 17, 41, 233, 7, 13, 31, 61
Offset: 1

Views

Author

Tim Johannes Ohrtmann, Jan 26 2018

Keywords

Comments

The n-th row is the A002997(n)-th row of A027746.
Length of the n-th row is A135717(n).
First term of the n-th row is A141710(n).
Last term of the n-th row is A081702(n).

Examples

			Array begins:
3, 11, 17,
5, 13, 17,
7, 13, 19,
5, 17, 29,
7, 13, 31.
		

Crossrefs

A376485 Carmichael numbers ordered by largest prime factor, then by size.

Original entry on oeis.org

561, 1105, 1729, 2465, 2821, 75361, 63973, 1050985, 6601, 41041, 29341, 172081, 552721, 852841, 10877581, 1256855041, 8911, 340561, 15182481601, 72720130561, 10585, 15841, 126217, 825265, 2433601, 496050841, 672389641, 5394826801, 24465723528961, 1074363265, 24172484701, 62745, 2806205689, 22541365441, 46657, 2113921, 6436473121, 6557296321, 13402361281, 26242929505, 65320532641, 143873352001, 105083995864811041
Offset: 1

Views

Author

Keywords

Examples

			17: 561, 1105;
19: 1729;
23:
29: 2465;
31: 2821, 75361;
37: 63973, 1050985;
41: 6601, 41041;
43:
47:
53:
59:
61: 29341, 172081, 552721, 852841, 10877581, 1256855041;
67: 8911, 340561, 15182481601;
71: 72720130561;
73: 10585, 15841, 126217, 825265, 2433601, 496050841, 672389641, 5394826801, 24465723528961;
79: 1074363265, 24172484701
83:
89: 62745, 2806205689, 22541365441;
97: 46657, 2113921, 6436473121, 6557296321, 13402361281, 26242929505, 65320532641, 143873352001, 105083995864811041
101: 101101, 252601, 2100901, 9494101, 6820479601, 109038862801, 102967089120001
		

Crossrefs

Cf. A002997, A081702, A283715 (row lengths).

Programs

  • PARI
    \\ This program is inefficient and functions as proof-of-concept only.
    Korselt(n)=my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]>1||(n-1)%(f[i, 1]-1), return(0))); 1
    car(n)=n%2 && !isprime(n) && Korselt(n) && n>1
    row(k)=my(p=prime(k)); fordiv(prod(i=2,k-1,prime(i)),n,if(car(p*n), print1(p*n,", ")))
    
  • Python
    from itertools import islice, combinations
    from math import prod
    from sympy import nextprime
    def A376485_gen(): # generator of terms
        plist, p = [3, 5], 7
        while True:
            clist = []
            for l in range(2,len(plist)+1):
                for q in combinations(plist,l):
                    k = prod(q)*p-1
                    if not (k%(p-1) or any(k%(r-1) for r in q)):
                        clist.append(k+1)
            yield from sorted(clist)
            plist.append(p)
            p = nextprime(p)
    A376485_list = list(islice(A376485_gen(),43)) # Chai Wah Wu, Sep 25 2024
Showing 1-5 of 5 results.