A362424 Number of partitions of n into 2 distinct perfect powers (A001597).
0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 2, 1, 1, 2, 1, 0, 0, 2, 2, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 2, 1, 0, 0, 0, 2, 1, 1, 0, 1, 0, 1, 0, 2, 0, 0, 2, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0, 2, 1, 1
Offset: 0
Keywords
Links
- Karl-Heinz Hofmann, Table of n, a(n) for n = 0..10000
- Eric Weisstein's World of Mathematics, Perfect Power.
Programs
-
Mathematica
perfectPowerQ[n_] := n == 1 || GCD @@ FactorInteger[n][[;; , 2]] > 1; a[n_] := Count[IntegerPartitions[n, {2}], ?(AllTrue[#, perfectPowerQ] && UnsameQ @@ # &)]; Array[a, 100, 0] (* _Amiram Eldar, May 05 2023 *)
-
Python
import numpy from math import isqrt A072103 = [] for m in range(2,isqrt(10001)+1): k = 2 while m**k < 10001: A072103.append(m**k) k += 1 A001597 = sorted(set(A072103)) # eliminates multiples and sorting A362424 = numpy.zeros(10001+1, dtype="i4") A001597 = [1] + A001597 # we need a "1" in front of A001597 a = 0 while A001597[a] < 10001 // 2: b = a + 1 while b < len(A001597) and A001597[a] + A001597[b] < 10001: A362424[A001597[a] + A001597[b]] += 1 b += 1 a += 1 print(list(A362424[0:92])) # Karl-Heinz Hofmann, Sep 16 2023