cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A225102 Numbers that can be represented as a sum of two distinct nontrivial prime powers (numbers of the form p^k where p is a prime number and k >= 2).

Original entry on oeis.org

12, 13, 17, 20, 24, 25, 29, 31, 33, 34, 35, 36, 40, 41, 43, 48, 52, 53, 57, 58, 59, 65, 68, 72, 73, 74, 76, 80, 81, 85, 89, 90, 91, 96, 97, 106, 108, 113, 125, 129, 130, 132, 133, 134, 136, 137, 141, 144, 145, 146, 148, 150, 152, 153, 155, 157, 160, 170, 173, 174, 177
Offset: 1

Views

Author

Alex Ratushnyak, Apr 28 2013

Keywords

Comments

Indices of positive terms in A225099.
Nontrivial prime powers are A025475 except the first term A025475(1) = 1.

Crossrefs

Programs

  • C
    #include 
    #include 
    #define TOP (1ULL<<17)
    unsigned long long *powers, pwFlat[TOP], primes[TOP] = {2};
    int main() {
      unsigned long long a, c, i, j, k, n, p, r, pp = 1, pfp = 0;
      powers = (unsigned long long*)malloc(TOP * TOP/8);
      memset(powers, 0, TOP * TOP/8);
      for (a = 3; a < TOP; a += 2) {
        for (p = 0; p < pp; ++p)  if (a % primes[p] == 0) break;
        if (p == pp)  primes[pp++] = a;
      }
      for (k = i = 0; i < pp; ++i)
        for (j = primes[i]*primes[i]; j < TOP*TOP; j *= primes[i])
          powers[j/64] |= 1ULL << (j & 63), ++k;
      if (k > TOP) exit(1);
      for (n = 0; n < TOP * TOP; ++n)
        if (powers[n/64] & (1ULL << (n & 63)))  pwFlat[pfp++] = n;
      for (n = 0; n < TOP * TOP; ++n) {
        for (c = i = 0; pwFlat[i] * 2 < n; ++i)
          r=n-pwFlat[i], c+= (powers[r/64] & (1ULL <<(r&63))) > 0;
        if (c)  printf("%llu, ", n);
      }
      return 0;
    }
  • Maple
    N:= 1000: # to get all terms <= N
    P:= select(isprime, [2,seq(i,i=3..floor(sqrt(N)),2)]):
    PP:= sort(map(p -> seq(p^t,t=2..floor(log[p](N))), P)):
    sort(convert(select(`<=`,{seq(seq(PP[i]+PP[j],j=1..i-1),i=1..nops(PP))},N),list)); # Robert Israel, Feb 21 2017
  • Mathematica
    nn = 177; p = Sort[Flatten[Table[Prime[n]^i, {n, PrimePi[Sqrt[nn]]}, {i, 2, Log[Prime[n], nn]}]]]; Select[Union[Flatten[Table[p[[i]] + p[[j]], {i, Length[p] - 1}, {j, i + 1, Length[p]}]]], # <= nn &] (* T. D. Noe, Apr 29 2013 *)