How to resolve the algorithm Chernick's Carmichael numbers step by step in the PARI/GP programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Chernick's Carmichael numbers step by step in the PARI/GP programming language

Table of Contents

Problem Statement

In 1939, Jack Chernick proved that, for n ≥ 3 and m ≥ 1: is a Carmichael number if all the factors are primes and, for n > 4, m is a multiple of 2^(n-4).

For n = 5, the smallest number m that satisfy Chernick's conditions, is m = 380, therefore U(5, 380) is the smallest Chernick's Carmichael number with 5 prime factors. U(5, 380) is a Chernick's Carmichael number because m = 380 is a multiple of 2^(n-4), where n = 5, and the factors { (6380 + 1), (12380 + 1), (18380 + 1), (36380 + 1), (72*380 + 1) } are all prime numbers.

For n ≥ 3, let a(n) be the smallest Chernick's Carmichael number with n prime factors.

Note: it's perfectly acceptable to show the terms in factorized form:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Chernick's Carmichael numbers step by step in the PARI/GP programming language

Source code in the pari/gp programming language

cherCar(n)={
  my(C=vector(n));C[1]=6; C[2]=12; for(g=3,n,C[g]=2^(g-2)*9);
  my(i=1); my(N(g)=while(i<=n&ispseudoprime(g*C[i]+1),i=i+1); return(i>n));
     i=1;  my(G(g)=while(i<=n&isprime(g*C[i]+1),i=i+1); return(i>n));
  i=1; if(n>4,i=2^(n-4)); if(n>5,i=i*5); my(m=i); while(!(N(m)&G(m)),m=m+i);
  printf("cherCar(%d): m = %d\n",n,m)}
for(x=3,9,cherCar(x))

  

You may also check:How to resolve the algorithm Enforced immutability step by step in the Elixir programming language
You may also check:How to resolve the algorithm Call a foreign-language function step by step in the OCaml programming language
You may also check:How to resolve the algorithm Kronecker product step by step in the AppleScript programming language
You may also check:How to resolve the algorithm Floyd's triangle step by step in the PHP programming language
You may also check:How to resolve the algorithm Hello world/Newline omission step by step in the Pict programming language