Path: csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!news.unit0.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Sat, 11 Mar 2017 01:42:34 -0600 From: Gareth Owen Newsgroups: comp.lang.c Subject: Re: Program to find consecutive integers References: <1bpohpg0sy.fsf@pfeifferfamily.net> <11e8e73e-fc33-48e7-92a7-6064330813cd@googlegroups.com> Date: Sat, 11 Mar 2017 07:42:33 +0000 Message-ID: <87bmt85keu.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:Oa4Fm3yllMuRCvCaaQxAGSaZsXw= MIME-Version: 1.0 Content-Type: text/plain Lines: 37 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-rQdyeh6o7AkyjEml+ezbZmzgYBb3ubSDjI3t9nZk7wuFVU2YrIPUN7ZkKFS3gCq0gi78pfI7a/Jzlhr!cWLtGfN8Reb7YhtXWLsUlSBDcfbUNoIJmKI1gk97F2JXJkYmwsOXrvut1QuqbyVmuxBT0pA= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2325 Xref: csiph.com comp.lang.c:105785 Ike Naar writes: > On 2017-03-10, jameskuyper@verizon.net wrote: >> Other possibilities include: >> {-14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, >> 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} >> >> I suspect that this is not what insane_goat meant, but until he >> specifies the problem to be solved more precisely, this seems to >> qualify. > > I was assuming that all numbers were meant to be positive integers. Let M = 2^N * (odd prime factors) For every odd factor (not necessarily prime), f of M there's a sequence length f centred on M/f and a sequence length f*2^(N+1) centred on M/(f*2^(N+1)) For M=15, odd factors 1,3,5,15 f=1 {15}, {7,8} f=3 {4,5,6}, {0,1,2,3,4,5} f=5 {1,2,3,4,5}, {-3,...6} f=15 {-6...8} {-14,....15} For M=8, odd factors 1 Only solutions f=1 {8} {-7...8} For M=24, odd factors 1,3 f=1 {24} {-6..9} f=3 {7,8,9} {-23..24} etc, etc, etc So all you need to is factorise ... which may be harder than you think