login
Numbers m such that, in the prime factorization of m! (with the primes in ascending order), no two successive exponents differ by a composite number.
0

%I #51 Jan 10 2022 22:24:00

%S 2,3,4,5,6,7,8,9,12,13,15,32,35,162,163

%N Numbers m such that, in the prime factorization of m! (with the primes in ascending order), no two successive exponents differ by a composite number.

%C Is this sequence finite?

%C After 163, there are no more terms through 10^10. - _Jon E. Schoenfield_, Dec 15 2021

%C Sequence is the same as numbers m such that, in the prime factorization of m! (with the exponents in ascending order), no two successive exponents differ by a composite number. This is due to the fact that in the factorization of m! with the primes in ascending order, the corresponding exponents are in descending order. - _Chai Wah Wu_, Jan 10 2022

%e 15! = 2^11 * 3^6 * 5^3 * 7^2 * 11^1 * 13^1; the exponents are 11, 6, 3, 2, 1, 1, and no two successive/neighboring exponents differ by a composite number, so 15 is a term of the sequence.

%t q[n_] := AllTrue[Differences @ Reverse[FactorInteger[n!][[;; , 2]]], !CompositeQ[#] &]; Select[Range[2, 200], q] (* _Amiram Eldar_, Dec 11 2021 *)

%o (Python)

%o import sympy

%o def last_exponent(c,i):

%o if sympy.nextprime(i//2)<=i:

%o if c==1 or sympy.isprime(c-1):

%o return(True)

%o else: return(False)

%o else:

%o if c==1 or sympy.isprime(c):

%o return(True)

%o else: return(False)

%o A350046_n=[2,3]

%o for i in range(4,1001):

%o p_expo=True

%o x = list(sympy.primerange(2,i//2+1))

%o prime_expo=[]

%o for j in (x):

%o c=i//j

%o s=0

%o while c!=0:

%o s=s+c

%o c=c//j

%o prime_expo.append(s)

%o c=prime_expo[0]

%o l=len(prime_expo)

%o for j in range(1,l):

%o c=c-prime_expo[j]

%o if c!=0:

%o if c!=1 and not sympy.isprime(c):

%o p_expo=False

%o break

%o c=prime_expo[j]

%o prime_expo=last_exponent(c,i)

%o if p_expo==True:

%o A350046_n.append(i)

%o print(A350046_n)

%o (Python)

%o from collections import Counter

%o from itertools import count, islice

%o from sympy import factorint, isprime

%o def A350046_gen(): # generator of terms

%o f = Counter()

%o for m in count(2):

%o f += Counter(factorint(m))

%o e = sorted(f.items())

%o if all(d <= 1 or isprime(d) for d in (abs(e[i+1][1]-e[i][1]) for i in range(len(e)-1))):

%o yield m

%o A350046_list = list(islice(A350046_gen(),15)) # _Chai Wah Wu_, Jan 10 2022

%o (PARI) valp(n,p)=my(s); while(n\=p, s+=n); s

%o is(n)=my(o=valp(n,2),e); forprime(p=3,, e=valp(n,p); if(o-e<4, return(1)); if(isprime(o-e), o=e, return(0))) \\ _Charles R Greathouse IV_, Dec 15 2021

%Y Cf. A000142, A330706.

%K nonn

%O 1,1

%A _Devansh Singh_, Dec 11 2021