A228018 Prime powers p (A025475) such that the sum of the proper divisors of p is also a prime power.
9, 49, 243, 961, 16129, 67092481, 17179607041, 274876858369, 4611686014132420609
Offset: 1
Examples
Proper divisors of 243 are 1, 3, 9, 27, 81, their sum is 121 = 11^2, so 243 is in the sequence.
Programs
-
C
#include
#include #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; } U64 findElement(U64 *a, U64 start, U64 end, U64 element) { if (start+1==end) return (a[start]==element); U64 mid = (start+end)/2; if (a[mid] > element) return findElement(a, start, mid, element); return findElement(a, mid, end, element); } int main() { U64 i, j, p, n=0, *pp = (U64*)malloc(TOP/2), sum; unsigned char *c = (unsigned char *)malloc(TOP/16); if (!c || !pp) exit(1); memset(c, 0, TOP/16); pp[n++] = 1; for (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<<60)*16.0)) break; } if (i>1) for (j=i*i>>1; j >3] |= 1<<(j&7); } if ((i&(i-2))==1) printf("%llu ", i); } printf("// %llu\n\n", n); qsort(pp, n, 8, compare64); for (i=1; i < TOP; i+=2) if ((c[i>>4] & (1<<((i>>1) & 7)))==0) for (p=i+(i==1), sum=1+p, j = p*p; ; j*=p) { if (findElement(pp, 0, n, sum)) printf("%llu, ", j); sum += j; double k = ((double)j) * ((double)p); if (k >= ((double)(1ULL<<60)*16.0)) break; } return 0; } -
PARI
for(n=1,10^6,if(!isprime(n),v=factor(n);if(matsize(v)[1]==1,s=sumdiv(n,d,d)-n;if(!isprime(s),vv=factor(s);if(matsize(vv)[1]==1,print(n)))))) /* Ralf Stephan, Aug 05 2013 */
Comments