Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Prime power-like integers.
4

%I #22 Feb 24 2020 15:41:27

%S 2,3,4,5,7,8,9,11,13,16,17,19,21,23,25,27,29,31,32,33,37,39,41,43,47,

%T 49,53,59,61,64,65,67,71,73,79,81,83,85,89,95,97,101,103,107,109,113,

%U 115,121,125,127,128,131,133,137,139,145,149,151,155,157,161,163,167,169

%N Prime power-like integers.

%C Let DTD(n) denote the difference table of the divisors of n. The DTDs of prime powers (in the sense of A246655) have only positive entries and the rows and columns of their DTD are nondecreasing.

%C We define an integer n>0 and not the unity to be prime power-like if and only if DTD(n) has only positive entries and nondecreasing rows and columns (read from left to right and from top to bottom).

%C This sequence lists the prime power-like integers and sequence A273201 lists the integers which are prime power-like but not prime powers. Thus we have the inclusions A000040 < A246655 < A273200 and the union A273200 = A273201 U A246655.

%C Integers which have a positive but not monotone DTD are listed in A273199. Integers with a positive DTD are listed in A273130.

%e 125 is in this sequence because it is a prime power and has the DTD:

%e [ 1 5 25 125]

%e [ 4 20 100]

%e [ 16 80]

%e [ 64]

%e 161 is in this sequence because the DTD of 161 has only positive entries and nondecreasing rows and columns:

%e [ 1 7 23 161]

%e [ 6 16 138]

%e [ 10 122]

%e [ 112]

%t pplikeQ[n_] := Module[{T, DTD, DTD2}, If[n == 1, Return[False]]; T = Divisors[n]; DTD = Table[Differences[T, k], {k, 0, Length[T] - 1}]; If[AnyTrue[Flatten[DTD], NonPositive], Return[False]]; DTD2 = Transpose[PadRight[#, Length[T], Infinity]& /@ DTD]; AllTrue[DTD, OrderedQ] && AllTrue[DTD2, OrderedQ]];

%t Select[Range[200], pplikeQ] (* _Jean-François Alcover_, Jun 28 2019 *)

%o (Sage)

%o def is_prime_power_like(n):

%o if n == 1: return False

%o D = divisors(n)

%o T = matrix(ZZ, len(D))

%o for m, d in enumerate(D):

%o T[0, m] = d

%o for k in range(m-1, -1, -1) :

%o T[m-k, k] = T[m-k-1, k+1] - T[m-k-1, k]

%o if T[m-k, k] <= 0: return False

%o non_decreasing = lambda L: all(x<=y for x, y in zip(L, L[1:]))

%o b = True

%o for k in range(len(D)-1):

%o b &= non_decreasing(T.row(k)[:len(D)-k])

%o b &= non_decreasing(T.column(k)[:len(D)-k])

%o if not b: return False

%o return b

%o [n for n in range(1, 170) if is_prime_power_like(n)]

%Y Cf. A000040, A246655, A273102, A273130, A273199, A273201.

%K nonn

%O 1,1

%A _Peter Luschny_, May 17 2016