login
A226230
Nontrivial prime powers (A025475) which are a sum of a smaller nontrivial prime power and a perfect square.
2
8, 9, 25, 32, 81, 125, 128, 169, 289, 343, 512, 625, 1681, 2048, 2197, 3125, 3721, 4913, 8192, 32761, 32768, 50653, 66049, 78125, 97969, 131072, 177241, 357911, 524288, 707281, 1030301, 1419857, 1442401, 1953125, 2097152, 2476099, 3031081, 3463321, 6355441, 7645373
OFFSET
1,1
EXAMPLE
81 = 32 + 7^2, so 81 is in the sequence.
169 = 25 + 12^2, so 169 is in the sequence.
MAPLE
for n from 1 do
if isA025475(n) then
for j from 1 do
pj := n-j^2 ;
if pj < 0 then
break;
elif isA025475(pj) then
printf("%d, \n", n);
break ;
end if;
end do:
end if:
end do: # R. J. Mathar, Jun 06 2013
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, 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=0; j < i; j++) {
t = p - pp[j];
r = sqrt(t);
if (r*r==t) { printf("%llu, ", p); break; }
}
return 0;
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 31 2013
STATUS
approved