login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


First occurrence of n in A225099, or -1 if n does not appear in A225099.
1

%I #11 Apr 29 2013 16:49:58

%S 0,12,36,370,3770,12410,202130,197210,81770,9151610,16046810,12625730,

%T 21899930,95336930,9549410,416392730,1016275130,338609570,789396530,

%U 601741010,254885930,10083683090,4690939370,29207671610,30431277890,22264417370,23231920010,10838858810,37462976330

%N First occurrence of n in A225099, or -1 if n does not appear in A225099.

%C Least integer k representable as a sum of two distinct nontrivial prime powers (A025475 except the first term) in exactly n ways.

%t nn = 300000; p = Sort[Flatten[Table[Prime[n]^i, {n, PrimePi[Sqrt[nn]]}, {i, 2, Log[Prime[n], nn]}]]]; t =Sort[Select[Flatten[Table[p[[i]] + p[[j]], {i, Length[p] - 1}, {j, i + 1, Length[p]}]], # <= nn &]]; t2 = Table[Count[t, n], {n, 0, nn}]; n2 = Max[t2]; Table[Position[t2, n, 1, 1][[1, 1]], {n, 0, n2}] - 1(* _T. D. Noe_, Apr 29 2013 *)

%o (C)

%o #include <stdio.h>

%o #include <stdlib.h>

%o #define TOP (5ULL<<16)

%o typedef unsigned long long U64;

%o U64 *mem, pwFlat[TOP], primes[TOP]={2}, f[96];

%o int pp_compare(const void *p1, const void *p2) {

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

%o if (*(U64*)p1 < *(U64*)p2) return -1;

%o return 1;

%o }

%o int main() {

%o U64 i, j, k, p, pp=1, pfp;

%o mem = (U64*)malloc(3ULL<<30);

%o for (i = 3; i < TOP; i+=2) {

%o for (p = 0; p < pp; ++p) if (i%primes[p] == 0) break;

%o if (p==pp) primes[pp++] = i;

%o }

%o for (pfp = i = 0; i < pp; ++i)

%o for (j = primes[i]*primes[i]; j < TOP*TOP; j *= primes[i])

%o pwFlat[pfp++] = j;

%o for (k = i = 0; i < pfp; ++i)

%o for (j = i+1; j < pfp; ++j)

%o if ((p = pwFlat[i] + pwFlat[j]) < TOP*TOP) mem[k++] = p;

%o qsort(mem, k, 8, pp_compare);

%o p = mem[0];

%o for (i = j = mem[k] = 1; i <= k; ++i) {

%o if (p == mem[i]) { ++j; continue; }

%o if (j < 96 && f[j] == 0) f[j] = p;

%o p = mem[i];

%o j = 1;

%o }

%o for (i = 0; i < 96; ++i) printf("%llu, ", f[i]);

%o return 0;

%o }

%Y Cf. A225099.

%K nonn

%O 0,2

%A _Alex Ratushnyak_, Apr 27 2013

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 23 16:16 EDT 2024. Contains 376178 sequences. (Running on oeis4.)