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.

A171618 Number of ways of writing n=k1+k2 with k1 and k2 in A167707.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 3, 2, 4, 3, 3, 3, 5, 4, 6, 5, 6, 5, 7, 6, 8, 6, 8, 8, 8, 9, 9, 10, 10, 9, 11, 10, 12, 12, 13, 11, 12, 13, 13, 15, 14, 14, 15, 14, 16, 14, 17, 17, 16, 17, 17, 18, 18, 19, 18, 19, 19, 21, 21, 19, 21, 20, 22, 24, 23, 22, 22, 23, 24, 25, 25, 24, 25, 24, 27, 26, 28, 27
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Dec 13 2009

Keywords

Examples

			a(31)=9 because 31 = 0 + 31 = 3 + 28 = 5 + 26 = 7 + 24 = 9 + 22 = 10 + 21 = 11 + 20 = 14 + 17 = 15 + 16.
		

Crossrefs

Programs

  • Maple
    isA001097 := proc(n) isprime(n) and (isprime(n+2) or isprime(n-2)) ; end proc:
    isA164276 := proc(n) not isprime(n) and ( not isprime(n+1) or not isprime(n-1) ) ; end proc: isA167707 := proc(n) isA001097(n) or isA164276(n) ; end proc:
    A167707 := proc(n) option remember; if n = 1 then 0; else for a from procname(n-1)+1 do if isA167707(a) then return a; end if; end do; end if; end proc:
    A171618 := proc(n) a := 0 ; for i from 1 do p := A167707(i) ; q := n-p ; if q < p then return a ; end if; if isA167707(q) then a := a+1 ; end if; if q <= p then return a ; end if; end do: end proc:
    seq(A171618(n),n=1..120) ; # R. J. Mathar, May 22 2010
  • Mathematica
    isA001097[n_] := PrimeQ[n] && (PrimeQ[n+2] || PrimeQ[n-2]);
    isA164276[n_] := !PrimeQ[n] && (!PrimeQ[n+1] ||!PrimeQ[n-1]);
    isA167707[n_] := isA001097[n] || isA164276[n];
    A167707[n_] := A167707[n] = If[n == 1, 0, For[a = A167707[n-1]+1, True, a++, If[isA167707[a], Return@a]]];
    A171618[n_] := Module[{a}, a = 0; For[i = 1, True, i++, p = A167707[i]; q = n-p; If[q < p, Return@a]; If[isA167707[q], a++]; If[q <= p, Return@a]]];
    Table[A171618[n], {n, 1, 120}] (* Jean-François Alcover, Feb 23 2024, after R. J. Mathar *)

Extensions

a(29) and a(34) corrected and sequence extended by R. J. Mathar, May 22 2010