Program to generate more members of the sequence A065978 in http://www.oeis.org/
- To: mathgroup at smc.vnet.net
- Subject: [mg131818] Program to generate more members of the sequence A065978 in http://www.oeis.org/
- From: Gilmar Rodriguez-pierluissi <peacenova at yahoo.com>
- Date: Wed, 9 Oct 2013 22:11:27 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- Reply-to: Gilmar Rodriguez-pierluissi <peacenova at yahoo.com>
Dear Math Group Gurus: The following module: Search[m_, k_] := Module[{M}, {M = {}; f[n_] := For[p = n/2, True, p--, If[PrimeQ[p] && PrimeQ[n - p], Return[n - 2 p]]]; For[n = m; max = -1, True, n += 2, If[n > k, Break[]]; If[f[n] > max, AppendTo[M, n]; max = f[n]]]}; M] generates the list given in: http://www.oeis.org/A065978/list For instance; Timing[Search[4, 4*10^8 ]] gives: {76786.2, {4, 8, 16, 44, 92, 242, 256, 272, 292, 476, 530, 572, 682, 688, 1052, 1808, 2228, 3382, 3472, 3502, 3562, 4952, 6194, 7102, 10262, 17008, 20684, 37052, 45128, 49552, 80144, 137414, 251806, 349826, 362534, 742856, 1655152, 1872236, 2108282, 2319728, 2707118, 5182214, 7518328, 10908124, 11939162, 12727966, 13279472, 13583338, 14366372, 18245438, 21572990, 47697614, 54144704, 92661736, 115978712, 366468878}} My question is; can the above module be modified to give the next member in this sequence; say a(57), knowing a(56) = 366468878 "apriori"? In other words; is it possible to get more members of this sequence without having to start a 4 all the time? For instance; Mathematica runs out of memory on my PC when I evaluate: Search[4, 6*10^8] Grateful to you; Gilmar Rodriguez Pierluissi peacenova at yahoo.com *** Hint: a(57) = 594912044.