cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-7 of 7 results.

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

Original entry on oeis.org

0, 12, 36, 370, 3770, 12410, 202130, 197210, 81770, 9151610, 16046810, 12625730, 21899930, 95336930, 9549410, 416392730, 1016275130, 338609570, 789396530, 601741010, 254885930, 10083683090, 4690939370, 29207671610, 30431277890, 22264417370, 23231920010, 10838858810, 37462976330
Offset: 0

Views

Author

Alex Ratushnyak, Apr 27 2013

Keywords

Comments

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

Crossrefs

Cf. A225099.

Programs

  • C
    #include 
    #include 
    #define TOP (5ULL<<16)
    typedef unsigned long long U64;
    U64 *mem, pwFlat[TOP], primes[TOP]={2}, f[96];
    int pp_compare(const void *p1, const void *p2) {
      if (*(U64*)p1 == *(U64*)p2) return 0;
      if (*(U64*)p1 < *(U64*)p2) return -1;
      return 1;
    }
    int main() {
      U64 i, j, k, p, pp=1, pfp;
      mem = (U64*)malloc(3ULL<<30);
      for (i = 3; i < TOP; i+=2) {
        for (p = 0; p < pp; ++p)  if (i%primes[p] == 0) break;
        if (p==pp)  primes[pp++] = i;
      }
      for (pfp = i = 0; i < pp; ++i)
        for (j = primes[i]*primes[i]; j < TOP*TOP; j *= primes[i])
          pwFlat[pfp++] = j;
      for (k = i = 0; i < pfp; ++i)
        for (j = i+1; j < pfp; ++j)
          if ((p = pwFlat[i] + pwFlat[j]) < TOP*TOP) mem[k++] = p;
      qsort(mem, k, 8, pp_compare);
      p = mem[0];
      for (i = j = mem[k] = 1; i <= k; ++i) {
        if (p == mem[i])  { ++j; continue; }
        if (j < 96 && f[j] == 0)  f[j] = p;
        p = mem[i];
        j = 1;
      }
      for (i = 0; i < 96; ++i)  printf("%llu, ", f[i]);
      return 0;
    }
  • Mathematica
    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 *)

A225102 Numbers that can be represented as a sum of two distinct nontrivial prime powers (numbers of the form p^k where p is a prime number and k >= 2).

Original entry on oeis.org

12, 13, 17, 20, 24, 25, 29, 31, 33, 34, 35, 36, 40, 41, 43, 48, 52, 53, 57, 58, 59, 65, 68, 72, 73, 74, 76, 80, 81, 85, 89, 90, 91, 96, 97, 106, 108, 113, 125, 129, 130, 132, 133, 134, 136, 137, 141, 144, 145, 146, 148, 150, 152, 153, 155, 157, 160, 170, 173, 174, 177
Offset: 1

Views

Author

Alex Ratushnyak, Apr 28 2013

Keywords

Comments

Indices of positive terms in A225099.
Nontrivial prime powers are A025475 except the first term A025475(1) = 1.

Crossrefs

Programs

  • C
    #include 
    #include 
    #define TOP (1ULL<<17)
    unsigned long long *powers, pwFlat[TOP], primes[TOP] = {2};
    int main() {
      unsigned long long a, c, i, j, k, n, p, r, pp = 1, pfp = 0;
      powers = (unsigned long long*)malloc(TOP * TOP/8);
      memset(powers, 0, TOP * TOP/8);
      for (a = 3; a < TOP; a += 2) {
        for (p = 0; p < pp; ++p)  if (a % primes[p] == 0) break;
        if (p == pp)  primes[pp++] = a;
      }
      for (k = i = 0; i < pp; ++i)
        for (j = primes[i]*primes[i]; j < TOP*TOP; j *= primes[i])
          powers[j/64] |= 1ULL << (j & 63), ++k;
      if (k > TOP) exit(1);
      for (n = 0; n < TOP * TOP; ++n)
        if (powers[n/64] & (1ULL << (n & 63)))  pwFlat[pfp++] = n;
      for (n = 0; n < TOP * TOP; ++n) {
        for (c = i = 0; pwFlat[i] * 2 < n; ++i)
          r=n-pwFlat[i], c+= (powers[r/64] & (1ULL <<(r&63))) > 0;
        if (c)  printf("%llu, ", n);
      }
      return 0;
    }
  • Maple
    N:= 1000: # to get all terms <= N
    P:= select(isprime, [2,seq(i,i=3..floor(sqrt(N)),2)]):
    PP:= sort(map(p -> seq(p^t,t=2..floor(log[p](N))), P)):
    sort(convert(select(`<=`,{seq(seq(PP[i]+PP[j],j=1..i-1),i=1..nops(PP))},N),list)); # Robert Israel, Feb 21 2017
  • Mathematica
    nn = 177; p = Sort[Flatten[Table[Prime[n]^i, {n, PrimePi[Sqrt[nn]]}, {i, 2, Log[Prime[n], nn]}]]]; Select[Union[Flatten[Table[p[[i]] + p[[j]], {i, Length[p] - 1}, {j, i + 1, Length[p]}]]], # <= nn &] (* T. D. Noe, Apr 29 2013 *)

A225103 Numbers that can be represented as a sum of two distinct nontrivial prime powers in two or more ways.

Original entry on oeis.org

36, 41, 57, 89, 113, 129, 130, 137, 153, 177, 185, 297, 305, 368, 370, 377, 410, 425, 537, 545, 561, 593, 633, 650, 657, 850, 857, 868, 873, 890, 969, 986, 1010, 1130, 1385, 1490, 1690, 1730, 1802, 1865, 1881, 1898, 1970, 2210, 2213, 2217, 2236, 2330, 2337
Offset: 1

Views

Author

Alex Ratushnyak, Apr 28 2013

Keywords

Comments

Indices of terms bigger than 1 in A225099.
Nontrivial prime powers are numbers of the form p^k where p is a prime number and k >= 2. That is, A025475 except the first term A025475(1) = 1.
Only 267 of the terms below 2^34 are odd.

Examples

			36 = 32 + 4 = 27 + 9, so 36 is in the sequence.
41 = 32 + 9 = 25 + 16, so 41 is in the sequence.
		

Crossrefs

Programs

  • Maple
    N:= 10^4: # to get all terms <= N
    PP:= [seq(seq(p^k, k=2..floor(log[p](N))),p = select(isprime, [2,seq(i,i=3..floor(sqrt(N)),2)]))]:
    npp:= nops(PP):
    res:= {}: R:= 'R':
    for i from 2 to npp do
      for j from 1 to i-1 do
        q:= PP[i]+PP[j];
        if assigned(R[q]) then res:= res union {q}
        else R[q]:= 1
        fi
    od od:
    sort(convert(res,list)); # Robert Israel, Feb 17 2017
  • Mathematica
    nn = 2409; p = Sort[Flatten[Table[Prime[n]^i, {n, PrimePi[Sqrt[nn]]}, {i, 2, Log[Prime[n], nn]}]]]; Transpose[Sort[Select[Tally[Flatten[Table[p[[i]] + p[[j]], {i, Length[p] - 1}, {j, i + 1, Length[p]}]]], #[[1]] <= nn && #[[2]] > 1 &]]][[1]] (* T. D. Noe, Apr 29 2013 *)

A282550 Perfect powers that are the sum of two distinct proper prime powers (A246547).

Original entry on oeis.org

25, 36, 81, 125, 144, 196, 324, 512, 576, 1089, 2304, 2744, 2916, 5041, 9216, 14884, 16641, 26244, 36864, 51984, 147456, 236196, 589824, 941192, 1196836, 2125764, 2359296, 9437184, 19131876, 37748736, 67125249, 150994944, 172186884, 322828856, 603979776
Offset: 1

Views

Author

Altug Alkan, Feb 18 2017

Keywords

Comments

Intersection of A001597 and A225102. - Michel Marcus, Feb 18 2017
Terms t of A001597 such that A225099(t) > 0. - Felix Fröhlich, Feb 18 2017

Examples

			512 = 2^9 is a term because 2^9 = 7^3 + 13^2.
		

Crossrefs

Programs

  • Mathematica
    Select[Union@ Map[Total, Subsets[With[{nn = 10^6}, Complement[ Select[ Range@ nn, PrimePowerQ], Prime[Range[PrimePi@ nn]]]], {2}]], # == 1 ||
    GCD @@ FactorInteger[#][[All, 2]] > 1 &] (* Michael De Vlieger, Feb 18 2017, after Harvey P. Dale at A246547 *)
  • PARI
    is(n) = if(!ispower(n), return(0), my(x=n-1, y=1); while(y < x, if(isprimepower(x) && isprimepower(y) && !ispseudoprime(x) && !ispseudoprime(y), return(1)); y++; x--)); 0 \\ Felix Fröhlich, Feb 18 2017

Extensions

More terms from Felix Fröhlich, Feb 18 2017
a(28)-a(35) from Giovanni Resta, May 07 2017

A225104 Numbers that can be represented as a sum of two distinct nontrivial prime powers in three or more ways.

Original entry on oeis.org

370, 650, 2210, 3770, 5330, 6290, 7202, 10370, 10730, 11570, 12410, 12818, 13130, 14690, 15170, 15650, 16250, 16490, 18122, 18530, 19370, 19610, 21170, 22490, 24050, 24650, 25010, 26690, 28730, 29930, 30290, 30770, 31610, 32810, 33410, 34970, 36482, 36490
Offset: 1

Views

Author

Alex Ratushnyak, Apr 28 2013

Keywords

Comments

Indices of terms bigger than 2 in A225099.
Nontrivial prime powers are numbers of the form p^k where p is a prime number and k >= 2. That is, A025475 except the first term A025475(1) = 1.
It appears that all terms less than 2^34 are even.

Crossrefs

Programs

  • Maple
    isA025475not1 := proc(n)
        if n <= 1 then
            false;
        elif isprime(n) then
            false;
        elif nops(numtheory[factorset](n)) = 1 then
            true;
        else
            false;
        end if;
    end proc:
    A025475not1 := proc(n)
        option remember;
        local a;
        if n = 1 then
            4;
        else
            for a from procname(n-1)+1 do
                if isA025475not1(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    A225104w := proc(n)
        local a,i,ppi,ppj ;
        a := 0 ;
        for i from 1 do
            ppi := A025475not1(i) ;
            if ppi >= n/2 then
                break;
            end if;
            ppj := n-ppi ;
            if isA025475not1(ppj) then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc:
    for n from 1 do
        if A225104w(n) >= 3 then
            print(n) ;
        end if;
    end do: # R. J. Mathar, Jun 13 2013
  • Mathematica
    nn = 36490; p = Sort[Flatten[Table[Prime[n]^i, {n, PrimePi[Sqrt[nn]]}, {i, 2, Log[Prime[n], nn]}]]]; Transpose[Sort[Select[Tally[Flatten[Table[p[[i]] + p[[j]], {i, Length[p] - 1}, {j, i + 1, Length[p]}]]], #[[1]] <= nn && #[[2]] > 2 &]]][[1]] (* T. D. Noe, Apr 29 2013 *)

A282533 Primes that are the sum of two proper prime powers (A246547) in more than one way.

Original entry on oeis.org

41, 89, 113, 137, 593, 857, 2213
Offset: 1

Views

Author

Altug Alkan, Feb 17 2017

Keywords

Comments

Primes of the form 2^k + p^e in more than one way where p is an odd prime (e > 1, k > 1).
Prime terms in A225103.
29 = 2^4 + 5^2 = 2 + 3^3 is a border case not included in this sequence - Olivier Gérard, Feb 25 2019
a(8) > 10^8 if it exists. - Robert Israel, Feb 17 2017
a(8) > 10^18 if it exists. - Charles R Greathouse IV, Feb 19 2017

Examples

			41 = 2^4 + 5^2 = 2^5 + 3^2.
89 = 2^3 + 3^4 = 2^6 + 5^2.
113 = 2^5 + 3^4 = 2^6 + 7^2.
137 = 2^7 + 3^2 = 2^4 + 11^2.
593 = 2^9 + 3^4 = 2^6 + 23^2.
857 = 2^7 + 3^6 = 2^4 + 29^2.
2213 = 2^4 + 13^3 = 2^2 + 47^2.
		

Crossrefs

Cf. A115231 (prime numbers which cannot be written as 2^a + p^b, b>=0)

Programs

  • MATLAB
    N = 10^8; % to get all terms <= N
    C = sparse(1,N);
    for p = primes(sqrt(N))
      C(p .^ [2:floor(log(N)/log(p))]) = 1;
    end
    R = zeros(1,N);
    for k = 2: floor(log2(N))
      R((2^k+1):N) = R((2^k+1):N) + C(1:(N-2^k));
    end
    P = primes(N);
    P(R(P) > 1.5) % Robert Israel, Feb 17 2017
    
  • Maple
    N:= 10^6: # to get all terms <= N
    B:= Vector(N):
    C:= Vector(N):
    for k from 2 to ilog2(N) do B[2^k]:= 1 od:
    p:= 2:
    do
      p:= nextprime(p);
      if p^2 > N then break fi;
      for k from 2 to floor(log[p](N)) do C[p^k]:= 1 od:
    od:
    R:= SignalProcessing:-Convolution(B,C):
    select(t -> isprime(t) and R[t-1] > 1.5, [seq(i,i=3..N,2)]); # Robert Israel, Feb 17 2017
  • Mathematica
    Select[Prime@ Range[10^3], Function[n, Count[Transpose@{n - #, #}, w_ /; Times @@ Boole@ Map[And[PrimePowerQ@ #, ! PrimeQ@ #] &, w] > 0] >= 2 &@ Range[4, Floor[n/2]]]] (* or *)
    With[{n = 10^8}, Keys@ Select[#, Length@ # > 1 &] &@ GroupBy[#, First] &@ SortBy[Transpose@ {Map[Total, #], #}, First] &@ Select[Union@ Map[Sort, Tuples[#, 2]], PrimeQ@ Total@ # &] &@ Flatten@ Map[#^Range[2, Log[#, Prime@ n]] &, Array[Prime@ # &, Floor@ Sqrt@ n]]] (* Michael De Vlieger, Feb 19 2017, latter program Version 10 *)
  • PARI
    is(n) = if(!ispseudoprime(n), return(0), my(x=n-1, y=1, i=0); while(y < x, if(isprimepower(x) > 1 && isprimepower(y) > 1, if(i==0, i++, return(1))); y++; x--)); 0 \\ Felix Fröhlich, Feb 18 2017
    
  • PARI
    has(p)=my(t,q); p>40 && sum(k=2,logint(p-9,2), t=2^k; sum(e=2,logint(p-t,3), ispower(p-t,e,&q) && isprime(q)))>1
    list(lim)=my(v=List(),t,q); lim\=1; if(lim<9,lim=9); for(k=2,logint(lim-9,2), t=2^k; for(e=2,logint(lim-t,3), forprime(p=3,sqrtnint(lim-t,e), q=t+p^e; if(isprime(q) && has(q), listput(v,q))))); Set(v) \\ Charles R Greathouse IV, Feb 18 2017

A365272 a(n) is the least positive integer that can be expressed as the sum of two distinct prime powers (A000961) in exactly n ways.

Original entry on oeis.org

1, 3, 5, 9, 12, 20, 30, 36, 48, 66, 72, 84, 90, 120, 144, 132, 150, 192, 180, 246, 264, 210, 252, 270, 294, 300, 330, 486, 360, 516, 522, 468, 390, 462, 420, 480, 540, 510, 570, 600, 714, 756, 936, 750, 690, 660, 630, 810, 780, 924, 870, 1296, 930, 1122, 1404, 840
Offset: 0

Views

Author

Ilya Gutkovskiy, Sep 07 2023

Keywords

Examples

			For n = 3: 9 = 1 + 8 = 2 + 7 = 4 + 5.
		

Crossrefs

Showing 1-7 of 7 results.