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.

A163636 The sum of all odd numbers from 2n-1 up to the n-th odd nonprime.

Original entry on oeis.org

1, 24, 60, 112, 153, 171, 253, 275, 336, 448, 525, 555, 640, 672, 828, 864, 969, 1155, 1197, 1320, 1449, 1495, 1632, 1680, 1728, 1875, 2133, 2407, 2580, 2640, 2700, 2760, 2820, 2880, 3069, 3264, 3328, 3672, 3740, 3808, 3876, 4248, 4320, 4551, 4625, 4864
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Aug 02 2009

Keywords

Examples

			a(1)=1. a(2)=3+5+7+9=24. a(3)=5+7+9+11+13+15=60.
		

Crossrefs

Programs

  • Maple
    A014076 := proc(n) option remember; local a; if n = 1 then 1; else for a from procname(n-1)+2 by 2 do if not isprime(a) then RETURN(a) ; fi; od: fi; end:
    A163636 := proc(n) local onpr; onpr := A014076(n) ; (onpr+2*n-1)*(onpr-2*n+3)/4; end: seq(A163636(n),n=1..80) ; # R. J. Mathar, Aug 08 2009
  • Mathematica
    A014076 := Select[Range[1, 10299, 2], PrimeOmega[#] != 1 &]; Table[(A014076[[n]] + 2*n - 1)*(A014076[[n]] - 2*n + 3)/4, {n, 1, 50}] (* G. C. Greubel, Jul 31 2017 *)
    Module[{nn=201,onp},onp=Select[Range[1,nn,2],!PrimeQ[#]&];Table[Total[ Range[ 2n-1,onp[[n]],2]],{n,Length[onp]}]] (* Harvey P. Dale, Jul 03 2020 *)
  • Python
    from sympy import primepi
    def A163636(n):
        if n == 1: return 1
        m, k, n2 = n-1, primepi(n) + n - 1 + (n>>1), (n<<1)-1
        while m != k:
            m, k = k, primepi(k) + n - 1 + (k>>1)
        return (lambda x: (x+n2)*(x-n2+2)>>2)(m) # Chai Wah Wu, Jul 31 2024

Formula

a(n) = A005408(n-1)+A005408(n)+...+A014076(n);
a(n) = ( A014076(n)+2*n-1 ) *( A014076(n)-2*n+3 )/4.

Extensions

Edited and a(21) corrected by R. J. Mathar, Aug 08 2009