login
Table read by rows: the n-th row gives the nonnegative integers k such that n - k is a power of k.
2

%I #17 Oct 17 2019 02:01:52

%S 0,1,2,2,3,4,2,3,5,6,4,7,8,2,5,9,10,3,6,11,12,7,13,14,8,15,16,2,9,17,

%T 18,4,10,19,20,11,21,22,12,23,24,13,25,26,14,27,28,3,5,15,29,30,16,31,

%U 32,2,17,33,34,18,35,36,19,37,38,20,39,40,6,21,41,42,22

%N Table read by rows: the n-th row gives the nonnegative integers k such that n - k is a power of k.

%C The n-th row has length A309978(n) for n > 1.

%H Peter Kagey, <a href="/A328446/b328446.txt">Table of n, a(n) for n = 1..10000</a>

%e Table begins

%e n | n-th row

%e ---+----------

%e 1 | 0

%e 2 | 1

%e 3 | 2

%e 4 | 2, 3

%e 5 | 4

%e 6 | 2, 3, 5

%e 7 | 6

%e 8 | 4, 7

%e 9 | 8

%e 10 | 2, 5, 9

%e 11 | 10

%e 12 | 3, 6, 11

%e 13 | 12

%e 14 | 7, 13

%e 15 | 14

%e 16 | 8, 15

%e 17 | 16

%e 18 | 2, 9, 17

%e For n = 10 the 10th row is 2, 5, 9 because

%e 10 - 2 = 2^3,

%e 10 - 5 = 5^1, and

%e 10 - 9 = 9^0.

%o (PARI) row(n) = {if (n==1, return ([0])); my(row = vector(0)); fordiv(n, d, if ((d>1) && (d<n) && (d^valuation(n-d, d) == n-d), row = concat(row, d))); concat(row, n-1);}

%o tabf(nn) = {for (n=1, nn, print(row(n)););} \\ _Michel Marcus_, Oct 16 2019

%Y Cf. A307092, A309978.

%K nonn,tabf

%O 1,3

%A _Peter Kagey_, Oct 15 2019