Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Only a fool fights in a burning house. -- Kank the Klingon, "Day of the Dove", stardate unknown


devel / comp.lang.forth / Re: test for repdigit - so called "Schnapszahl in German"

SubjectAuthor
* test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
+* Re: test for repdigit - so called "Schnapszahl in German"Zbig
|`- Re: test for repdigit - so called "Schnapszahl in German"Zbig
`* Re: test for repdigit - so called "Schnapszahl in German"Alexander Wegel
 `* Re: test for repdigit - so called "Schnapszahl in German"Alexander Wegel
  `* Re: test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
   +* Re: test for repdigit - so called "Schnapszahl in German"Zbig
   |`* Re: test for repdigit - so called "Schnapszahl in German"Zbig
   | +- Re: test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
   | `* Re: test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
   |  `* Re: test for repdigit - so called "Schnapszahl in German"Marcel Hendrix
   |   `* Re: test for repdigit - so called "Schnapszahl in German"dxforth
   |    `* Re: test for repdigit - so called "Schnapszahl in German"Marcel Hendrix
   |     `* Re: test for repdigit - so called "Schnapszahl in German"dxforth
   |      `* Re: test for repdigit - so called "Schnapszahl in German"Marcel Hendrix
   |       `- Re: test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
   +* Re: test for repdigit - so called "Schnapszahl in German"Gerry Jackson
   |+* Re: test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
   ||+* Re: test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
   |||`* Re: test for repdigit - so called "Schnapszahl in German"Gerry Jackson
   ||| `* Re: test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
   |||  +* Re: test for repdigit - so called "Schnapszahl in German"Marcel Hendrix
   |||  |`- Re: test for repdigit - so called "Schnapszahl in German"Marcel Hendrix
   |||  `- Re: test for repdigit - so called "Schnapszahl in German"Zbig
   ||`- Re: test for repdigit - so called "Schnapszahl in German"kuku@physik.rwth-aachen.de
   |`- Re: test for repdigit - so called "Schnapszahl in German"none
   `- Re: test for repdigit - so called "Schnapszahl in German"Alexander Wegel

Pages:12
Re: test for repdigit - so called "Schnapszahl in German"

<1d2a1fea-26ad-4411-a500-c9e1cb291ff8n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18872&group=comp.lang.forth#18872

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1467:b0:6af:3f68:6be7 with SMTP id j7-20020a05620a146700b006af3f686be7mr18702880qkl.717.1656916783544;
Sun, 03 Jul 2022 23:39:43 -0700 (PDT)
X-Received: by 2002:a05:620a:2892:b0:6ae:bc44:6bb1 with SMTP id
j18-20020a05620a289200b006aebc446bb1mr19405379qkp.233.1656916783372; Sun, 03
Jul 2022 23:39:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 3 Jul 2022 23:39:43 -0700 (PDT)
In-Reply-To: <8cc79a9a-d850-4d82-ba31-17c7bd735c39n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:e3:2700:5600:589e:dd0e:7316:1756;
posting-account=PFpM6wkAAAAQLqwaaW6fT6Z2FjRrHWrg
NNTP-Posting-Host: 2003:e3:2700:5600:589e:dd0e:7316:1756
References: <af404905-4a8a-4acc-a304-cd7a0e503298n@googlegroups.com>
<1puh393.9yncoyz728w5N%awegel@arcor.de> <1puhc68.1l272nswknzb2N%awegel@arcor.de>
<aea6b03d-a049-4d57-86a6-32e805719812n@googlegroups.com> <c829a923-0a7f-4bf5-9315-0c7ff93031e4n@googlegroups.com>
<2c0d7384-ea6f-4618-82ad-f05e0c9e73ffn@googlegroups.com> <e1f6c067-c538-4813-82a7-8cd48c2a5581n@googlegroups.com>
<cc3d22c5-7026-471b-a5a7-5a0db1908c0bn@googlegroups.com> <t9sbak$3q6$1@gioia.aioe.org>
<a0aa78e3-c02a-4c78-83b2-d94342a30d85n@googlegroups.com> <t9tjgi$u0d$1@gioia.aioe.org>
<8cc79a9a-d850-4d82-ba31-17c7bd735c39n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1d2a1fea-26ad-4411-a500-c9e1cb291ff8n@googlegroups.com>
Subject: Re: test for repdigit - so called "Schnapszahl in German"
From: kuk...@physik.rwth-aachen.de (kuku@physik.rwth-aachen.de)
Injection-Date: Mon, 04 Jul 2022 06:39:43 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 6
 by: kuku@physik.rwth-aac - Mon, 4 Jul 2022 06:39 UTC

Thanks to all for the discussion and interesting solutions. In our local newspaper there is a math riddle column
coming up with some brainteaser every weekend. The 42 is special since it is mentioned e.g. here:
https://www.scientificamerican.com/article/for-math-fans-a-hitchhikers-guide-to-the-number-42/
I have no idea about the 80. all which comes to mind is, that the column width of punched cards was 80 :)
--
Christoph

Re: test for repdigit - so called "Schnapszahl in German"

<nnd$628fb97e$6a657902@4785e46a9e70831c>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18874&group=comp.lang.forth#18874

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <af404905-4a8a-4acc-a304-cd7a0e503298n@googlegroups.com> <1puhc68.1l272nswknzb2N%awegel@arcor.de> <aea6b03d-a049-4d57-86a6-32e805719812n@googlegroups.com> <t9rhlk$2uh87$1@dont-email.me>
Subject: Re: test for repdigit - so called "Schnapszahl in German"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$628fb97e$6a657902@4785e46a9e70831c>
Organization: KPN B.V.
Date: Mon, 04 Jul 2022 09:31:14 +0200
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 98
Injection-Date: Mon, 04 Jul 2022 09:31:14 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 3435
 by: none - Mon, 4 Jul 2022 07:31 UTC

In article <t9rhlk$2uh87$1@dont-email.me>,
Gerry Jackson <do-not-use@swldwa.uk> wrote:
>On 03/07/2022 08:26, kuku@physik.rwth-aachen.de wrote:
>> Alexander Wegel schrieb am Samstag, 2. Juli 2022 um 19:18:21 UTC+2:
>>> Alexander Wegel <awe...@arcor.de> wrote:
>>>
>>>> The thing to take home: a schnapszahl is a multiple of 11 in the current
>>>> number base.
>>> Anyway, it's just the same principle as in zbigs code 8-)
>>
>> Alexander, thanks for the "multiple of 11" remark, but doesn't help in
>the problem solution.
>> One could extend the rule to 111 for 3 digit results and so on.
>>
>> @Zbig: the problem to solve is: name all bases in which the given
>number (80,42) is a repdigit number.
>> For the 80, the result should be:
>>
>> 80
>> base number
>> 3 2222
>> 9 22
>
>22 in base 9 is decimal 20
>
>> 19 44
>> 39 22
>> 79 11
>>
>> Your algorithm finds the 9 (only)
>>
>>
>> 42
>> base number
>> 4 222
>> 13 33
>> 20 22
>> 41 11: divisor ( #digits -- n-ones ) 0 tuck ?do base @ * 1+ loop ;
>
>\ Extending Alexander Wegel's idea to 11...1, in bases 2 to 36 ANS max
>\ base
>
>: #digits ( ud -- #digs ) <# #s #> nip ;
>
>: repdigit? ( ud -- f )
> 2dup #digits dup 2 < if drop nip exit then
> divisor sm/rem drop 0=
>;
>
>: report ( n f -- )
> 0= if drop exit then
> base @ >r decimal cr ." Base: " r@ 2 .r
> ." , Number: #" dup 0 .r
> r> base ! ." , Repdigit: " .
>;
>
>: repdigit ( n -- )
> dup 0 ( -- n ud )
> 37 2
> do
> i base ! 2>r
> 2r@ repdigit? ( -- n f )
> over swap report 2r> ( -- n ud )
> loop 2drop drop decimal
>;
>
>#42 repdigit cr
>Base: 4, Number: #42, Repdigit: 222
>Base: 13, Number: #42, Repdigit: 33
>Base: 20, Number: #42, Repdigit: 22 ok
>
>#80 repdigit
>Base: 3, Number: #80, Repdigit: 2222
>Base: 9, Number: #80, Repdigit: 88
>Base: 15, Number: #80, Repdigit: 55
>Base: 19, Number: #80, Repdigit: 44 ok

A better algorithm is this for every BASE and number:

1. BASE > number , trivially true
2. n' = base + 1
3. temp= n' * base + 1
If temp > number, goto 4
set n' to temp, and goto 2
4. if n' divides number, number is repdigit
terminate
>
>
>--
>Gerry

Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor