login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A226231 Nontrivial prime powers (A025475) which are a sum of a smaller nontrivial prime power and a perfect square in more than 1 way. 2
25, 125, 512, 3125, 4913, 50653, 78125, 7645373, 48828125, 69343957, 310288733, 410338673, 1220703125, 4103684801, 24820429213, 164296466333, 296709280757, 762939453125, 1772000266301, 10368641602001, 11392143817501, 19073486328125, 29724740184833, 72079590632113 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Subsequence of A226230.

LINKS

Table of n, a(n) for n=1..24.

EXAMPLE

125 = 4 + 11^2 = 25 + 10^2 = 121 + 4^2. Because there are three representations, 125 is in the sequence. Note that 100 + 5^2 is not listed, because 100 is not a prime power.

PROG

(C)

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

#define TOP (1ULL<<32)

typedef unsigned long long U64;

int compare64(const void *p1, const void *p2) {

  if (*(U64*)p1== *(U64*)p2) return 0;

  return (*(U64*)p1 < *(U64*)p2) ? -1 : 1;

}

int main() {

  U64 i, j, k, p, t, r, n=0, *pp = (U64*)malloc(TOP/2);

  unsigned char *c = (unsigned char *)malloc(TOP/8);

  memset(c, 0, TOP/8);

  for (pp[n++] = i = 1; i < TOP; i+=2)

    if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {

      for (p=i+(i==1), j = p*p; ; j*=p) {

        pp[n++] = j;

        double k = ((double)j) * ((double)p);

        if (k >= ((double)(1ULL<<62)*4.0)) break;

      }

      if(i>1) for (j=i*i>>1; j<TOP; j+=i)  c[j>>3]|= 1<<(j&7);

    }

  qsort(pp, n, 8, compare64);

  for (i = 0; i < n; i++)

    for (p=pp[i], j = k = 0; j < i; j++) {

      t = p - pp[j];

      r = sqrt(t);

      if (r*r==t && ++k==2) { printf("%llu, ", p); break; }

    }

  return 0;

}

CROSSREFS

Cf. A025475, A226230, A226232.

Sequence in context: A036321 A289337 A211581 * A211595 A066609 A074006

Adjacent sequences:  A226228 A226229 A226230 * A226232 A226233 A226234

KEYWORD

nonn

AUTHOR

Alex Ratushnyak, May 31 2013

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 16 21:37 EST 2020. Contains 331975 sequences. (Running on oeis4.)