Path: utzoo!attcan!uunet!mcsun!unido!gmdzi!wittig From: wittig@gmdzi.gmd.de (Georg Wittig) Newsgroups: comp.lang.c Subject: % operator (was Re: count of bits set in a long) Message-ID: <3417@gmdzi.gmd.de> Date: 1 Oct 90 14:05:38 GMT References: <37545@ut-emx.uucp> <3820@goanna.cs.rmit.oz.au> <34281@cup.portal.com> <2859@litchi.bbn.com> <51467@brunix.UUCP> Organization: GMD - The German National Research Center for Computer Science Lines: 17 tac@cs.brown.edu (Theodore A. Camus) writes: >However, 077 in octal is 63 in decimal, and I believe the following ^^^^^^^^^ >relationship is true : x % 63 = [(x % 64) + (x / 64)] % 63 Does there exist a proof for that equation? Can it be found in literature? Is the following true? x % n = (x%(n+1) + floor(x/(n+1))) % n (n != 0;n != -1) Do there exist similar "surprising" equations? -- Georg Wittig GMD-Z1.IT | wittig@gmdzi.gmd.de | "Freedom's just another word P.O. Box 1240 | | for nothing left to lose" D-5205 St. Augustin 1 | | (Kris Kristofferson) West Germany | (+49) 2241 14-2294 |