Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #105785

Re: Program to find consecutive integers

From Gareth Owen <gwowen@gmail.com>
Newsgroups comp.lang.c
Subject Re: Program to find consecutive integers
References (1 earlier) <1bpohpg0sy.fsf@pfeifferfamily.net> <o9ti7j$lnp$1@gioia.aioe.org> <slrn3vfsoc4oes.lda.ike@iceland.freeshell.org> <11e8e73e-fc33-48e7-92a7-6064330813cd@googlegroups.com> <slrn3vfsoc5v88.fq0.ike@iceland.freeshell.org>
Date 2017-03-11 07:42 +0000
Message-ID <87bmt85keu.fsf@gmail.com> (permalink)

Show all headers | View raw


Ike Naar <ike@iceland.freeshell.org> writes:

> On 2017-03-10, jameskuyper@verizon.net <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

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Program to find consecutive integers insane_goat <nobody@nothing.net> - 2017-03-10 04:21 +0000
  Re: Program to find consecutive integers Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-03-09 22:26 -0700
    Re: Program to find consecutive integers insane_goat <nobody@nothing.net> - 2017-03-10 06:48 +0000
      Re: Program to find consecutive integers Ike Naar <ike@iceland.freeshell.org> - 2017-03-10 08:18 +0000
        Re: Program to find consecutive integers insane_goat <nobody@nothing.net> - 2017-03-10 08:48 +0000
          Re: Program to find consecutive integers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-10 10:38 +0000
            Re: Program to find consecutive integers insane_goat <nobody@nothing.net> - 2017-03-12 13:15 +0000
              Re: Program to find consecutive integers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-12 13:29 +0000
            Re: Program to find consecutive integers raltbos@xs4all.nl (Richard Bos) - 2017-03-14 07:49 +0000
          Re: Program to find consecutive integers Öö Tiib <ootiib@hot.ee> - 2017-03-10 05:12 -0800
        Re: Program to find consecutive integers jameskuyper@verizon.net - 2017-03-10 07:16 -0800
          Re: Program to find consecutive integers Ike Naar <ike@iceland.freeshell.org> - 2017-03-10 19:20 +0000
            Re: Program to find consecutive integers James Kuyper <jameskuyper@verizon.net> - 2017-03-10 15:21 -0500
              Re: Program to find consecutive integers Ike Naar <ike@iceland.freeshell.org> - 2017-03-10 20:36 +0000
              Re: Program to find consecutive integers insane_goat <nobody@nothing.net> - 2017-03-12 13:19 +0000
                Gotta keep up with the times (Was: Program to find consecutive integers) gazelle@shell.xmission.com (Kenny McCormack) - 2017-03-12 13:25 +0000
                Re: Gotta keep up with the times (Was: Program to find consecutive integers) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-03-12 08:11 -0700
                Re: Gotta keep up with the times (Was: Program to find consecutive integers) gazelle@shell.xmission.com (Kenny McCormack) - 2017-03-12 15:53 +0000
                Re: Gotta keep up with the times (Was: Program to find consecutive integers) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-03-12 10:50 -0700
                Re: Gotta keep up with the times (Was: Program to find consecutive integers) gazelle@shell.xmission.com (Kenny McCormack) - 2017-03-12 18:25 +0000
                Re: Gotta keep up with the times (Was: Program to find consecutive integers) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-03-12 16:20 -0700
                Re: Gotta keep up with the times gordonb.g2pqz@burditt.org (Gordon Burditt) - 2017-03-14 01:09 -0500
                Re: Gotta keep up with the times raltbos@xs4all.nl (Richard Bos) - 2017-03-14 07:43 +0000
                Re: Program to find consecutive integers "James R. Kuyper" <jameskuyper@verizon.net> - 2017-03-12 10:28 -0400
            Re: Program to find consecutive integers Gareth Owen <gwowen@gmail.com> - 2017-03-11 07:42 +0000
      Re: Program to find consecutive integers jt@toerring.de (Jens Thoms Toerring) - 2017-03-10 10:21 +0000
        Re: Program to find consecutive integers Nathan Wagner <nw@hydaspes.if.org> - 2017-03-10 22:07 +0000
          Re: Program to find consecutive integers Nathan Wagner <nw@hydaspes.if.org> - 2017-03-10 22:20 +0000
          Re: Program to find consecutive integers jr <creature.eternal@gmail.com> - 2017-03-10 23:49 -0800
        Re: Program to find consecutive integers jt@toerring.de (Jens Thoms Toerring) - 2017-03-11 23:38 +0000
          Re: Program to find consecutive integers Tim Rentsch <txr@alumni.caltech.edu> - 2017-04-16 21:18 -0700

csiph-web