OFFSET
1,1
COMMENTS
Eight of the first nine terms are squares of Mersenne primes (A133049).
From Pontus von Brömssen, Sep 17 2024: (Start)
All squares of Mersenne primes are terms.
10^20 < a(10) <= A133049(9) = (2^61-1)^2.
All terms are odd. Otherwise, 2^k would be a term for some positive k >= 2 and then A001065(2^k) = 2^k-1 would be a prime power in A025475, which is impossible by Catalan's conjecture (Mihăilescu's theorem).
(End)
EXAMPLE
Proper divisors of 243 are 1, 3, 9, 27, 81, their sum is 121 = 11^2, so 243 is in the sequence.
PROG
(C)
#include <stdio.h>
#include <stdlib.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;
}
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<TOP/2; j+=i) c[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 */
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Alex Ratushnyak, Aug 02 2013
STATUS
approved