OFFSET
1,1
COMMENTS
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.
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).
EXAMPLE
125 is in this sequence because it is a prime power and has the DTD:
[ 1 5 25 125]
[ 4 20 100]
[ 16 80]
[ 64]
161 is in this sequence because the DTD of 161 has only positive entries and nondecreasing rows and columns:
[ 1 7 23 161]
[ 6 16 138]
[ 10 122]
[ 112]
MATHEMATICA
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]];
Select[Range[200], pplikeQ] (* Jean-François Alcover, Jun 28 2019 *)
PROG
(Sage)
def is_prime_power_like(n):
if n == 1: return False
D = divisors(n)
T = matrix(ZZ, len(D))
for m, d in enumerate(D):
T[0, m] = d
for k in range(m-1, -1, -1) :
T[m-k, k] = T[m-k-1, k+1] - T[m-k-1, k]
if T[m-k, k] <= 0: return False
non_decreasing = lambda L: all(x<=y for x, y in zip(L, L[1:]))
b = True
for k in range(len(D)-1):
b &= non_decreasing(T.row(k)[:len(D)-k])
b &= non_decreasing(T.column(k)[:len(D)-k])
if not b: return False
return b
[n for n in range(1, 170) if is_prime_power_like(n)]
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, May 17 2016
STATUS
approved