Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why is a (factorial - 1) rarely a square ? ---------- ( _losopher of _sic in _na ... )

18 views
Skip to first unread message

henh...@gmail.com

unread,
Jul 26, 2022, 2:22:25 PM7/26/22
to
https://i.redd.it/fbnsyfvp5id91.png ( _losopher of _sic in _na ........ )


Why is a (factorial) rarely a square ?



Why is a (factorial - 1) rarely a square ?



Why is a (factorial + 1) rarely a square ?

( 4 ! + 1 ) = 25 = 5*5

Richard Tobin

unread,
Jul 26, 2022, 3:15:02 PM7/26/22
to
In article <4973fd1a-3e40-4214...@googlegroups.com>,
henh...@gmail.com <henh...@gmail.com> wrote:

>Why is a (factorial) rarely a square ?

For n>1, n! is never a square. This follows trivially [walks away,
returns a couple of minutes later], yes trivially, from Bertrand's
postulate.

-- Richard

Richard Heathfield

unread,
Jul 26, 2022, 4:05:54 PM7/26/22
to
I have a truly marvelous proof of Mr Tobin's statement, which
Usenet is too narrow to contain.

--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

Richard Heathfield

unread,
Jul 27, 2022, 10:06:14 AM7/27/22
to
On 26/07/2022 8:13 pm, Richard Tobin wrote:
> In article <4973fd1a-3e40-4214...@googlegroups.com>,
> henh...@gmail.com <henh...@gmail.com> wrote:
>
>> Why is a (factorial) rarely a square ?
>
> For n>1, n! is never a square.

I note in passing that it comes close four or five times, notably
7!, which is just 1 shy of 71^2.

I further note in passing that the subject line asks about n!-1
rather than n! itself, but I tried it both ways and it turns out
to matter little.

> This follows trivially [walks away,
> returns a couple of minutes later], yes trivially, from Bertrand's
> postulate.

I think I can trivialise this still further.

#include <stdio.h>
#include <limits.h>

int main(void)
{
printf("%lu\n", ULONG_MAX);
return 0;
}

yields 18446744073709551615, the largest available positive
integer without going to ridiculous (and indeed non-trivial)
extremes like departing from C89.

The largest non-trivial factorial is therefore 20! or
2432902008176640000.

(21 is 51090942171709440000, which is simply too big to be
trivial; let us not exceed our brief.)

1! = 1 IS a square: root 1^2 is out by 0
2! = 2 is NOT a square: root 1^2 is out by 1
3! = 6 is NOT a square: root 2^2 is out by 2
4! = 24 is NOT a square: root 5^2 is out by 1
5! = 120 is NOT a square: root 11^2 is out by 1
6! = 720 is NOT a square: root 27^2 is out by 9
7! = 5040 is NOT a square: root 71^2 is out by 1
8! = 40320 is NOT a square: root 201^2 is out by 81
9! = 362880 is NOT a square: root 602^2 is out by 476
10! = 3628800 is NOT a square: root 1905^2 is out by 225
11! = 39916800 is NOT a square: root 6318^2 is out by 324

I ran it all the way up to and including 20. After 11!, the
discrepancy between the factorial and the square of its nearest
integer root (which discrepancy must be 0 for a solution)
continues to climb by amounts that increase by, on average, close
to an order of magnitude per factorial.

And, unless you want to get non-trivial, them's all the numbers
there is. QED.

henh...@gmail.com

unread,
Jul 27, 2022, 2:25:09 PM7/27/22
to
i'm wondering ... After these... When does it get close again ?

11! = 39916800 ( 12311 , 324 ) ( 97.44 , 2.56 ) %
27! = 10888869450418352160768000000 ( 204033398880671 , 4666092737476 ) ( 97.76 , 2.24 ) %

(27!) is already so big that 2% doesn't seem so close anymore.


_________________________

1! = 1 ( 0 , 3 ) ( 0 , 100.0 ) %

2! = 2 ( 1 , 2 ) ( 33.33 , 66.67 ) %

3! = 6 ( 2 , 3 ) ( 40.0 , 60.0 ) %

4! = 24 ( 8 , 1 ) ( 88.89 , 11.11 ) %

5! = 120 ( 20 , 1 ) ( 95.24 , 4.76 ) %

6! = 720 ( 44 , 9 ) ( 83.02 , 16.98 ) %

7! = 5040 ( 140 , 1 ) ( 99.29 , 0.71 ) %

8! = 40320 ( 320 , 81 ) ( 79.8 , 20.2 ) %

9! = 362880 ( 476 , 729 ) ( 39.5 , 60.5 ) %

10! = 3628800 ( 3584 , 225 ) ( 94.09 , 5.91 ) %

11! = 39916800 ( 12311 , 324 ) ( 97.44 , 2.56 ) %

12! = 479001600 ( 4604 , 39169 ) ( 10.52 , 89.48 ) %

13! = 6227020800 ( 74879 , 82944 ) ( 47.44 , 52.56 ) %

14! = 87178291200 ( 414119 , 176400 ) ( 70.13 , 29.87 ) %

15! = 1307674368000 ( 2071775 , 215296 ) ( 90.59 , 9.41 ) %

16! = 20922789888000 ( 5703551 , 3444736 ) ( 62.35 , 37.65 ) %

17! = 355687428096000 ( 11551671 , 26167684 ) ( 30.63 , 69.37 ) %

18! = 6402373705728000 ( 45680444 , 114349225 ) ( 28.54 , 71.46 ) %

19! = 121645100408832000 ( 442548224 , 255004929 ) ( 63.44 , 36.56 ) %

20! = 2432902008176640000 ( 1960632176 , 1158920361 ) ( 62.85 , 37.15 ) %

21! = 51090942171709440000 ( 2657058876 , 11638526761 ) ( 18.59 , 81.41 ) %

22! = 1124000727777607680000 ( 24923993276 , 42128246889 ) ( 37.17 , 62.83 ) %

23! = 25852016738884976640000 ( 130518272975 , 191052974116 ) ( 40.59 , 59.41 ) %

24! = 620448401733239439360000 ( 1478154932316 , 97216010329 ) ( 93.83 , 6.17 ) %

25! = 15511210043330985984000000 ( 5446454455004 , 2430400258225 ) ( 69.15 , 30.85 ) %

26! = 403291461126605635584000000 ( 38610655379975 , 1553580508516 ) ( 96.13 , 3.87 ) %

27! = 10888869450418352160768000000 ( 204033398880671 , 4666092737476 ) ( 97.76 , 2.24 ) %

28! = 304888344611713860501504000000 ( 538347188396016 , 565986718738441 ) ( 48.75 , 51.25 ) %

29! = 8841761993739701954543616000000 ( 3809155729331900 , 2137864362693921 ) ( 64.05 , 35.95 ) %

30! = 265252859812191058636308480000000 ( 27460809907547975 , 5112360635841936 ) ( 84.3 , 15.7 ) %

31! = 8222838654177922817725562880000000 ( 52607402757814775 , 128752335378056196 ) ( 29.01 , 70.99 ) %

32! = 263130836933693530167218012160000000 ( 260599968274292919 , 765325637086434064 ) ( 25.4 , 74.6 ) %

33! = 8683317618811886495518194401280000000 ( 4946344303884983516 , 947149606797163441 ) ( 83.93 , 16.07 ) %

34! = 295232799039604140847618609643520000000 ( 11268404003386411164 , 23096275482364893649 ) ( 32.79 , 67.21 ) %

35! = 10333147966386144929666651337523200000000 ( 49693019852305886759 , 153611165706045517584 ) ( 24.44 , 75.56 ) %

36! = 371993326789901217467999448150835200000000 ( 569123601332903497271 , 650701512017204928784 ) ( 46.66 , 53.34 ) %

37! = 13763753091226345046315979581580902400000000 ( 5553210888420637223900 , 1866695604582180947481 ) ( 74.84 , 25.16 ) %

38! = 523022617466601111760007224100074291200000000 ( 8221172400438234781599 , 37518203085748767234304 ) ( 17.97 , 82.03 ) %

39! = 20397882081197443358640281739902897356800000000 ( 66477907253778706052351 , 219164401105451883320836 ) ( 23.27 , 76.73 ) %

40! = 815915283247897734345611269596115894272000000000 ( 315962139518370239927900 , 1490598441528274577343321 ) ( 17.49 , 82.51 ) %

41! = 33452526613163807108170062053440751665152000000000 ( 4303974373003395286935119 , 7263657469887146344632100 ) ( 37.21 , 62.79 ) %

Richard Tobin

unread,
Jul 27, 2022, 4:20:03 PM7/27/22
to
In article <tbphev$25ufh$1...@dont-email.me>,
Richard Heathfield <r...@cpax.org.uk> wrote:

>> For n>1, n! is never a square. This follows trivially [walks away,
>> returns a couple of minutes later], yes trivially, from Bertrand's
>> postulate.

>I have a truly marvelous proof of Mr Tobin's statement, which
>Usenet is too narrow to contain.

The basic idea is simple: any prime factor of a square must occur
twice (or 4 times, or 6 ...). (We had an example of that the other
day: any even square is a multiple of 4.)

Consider even n (= 2N, say).

(2N)! = 1 x 2 x .... x (N-1) x N x (N+1) x ... x (2N-1) x 2N

If there is a prime p in the second half - N+1 ... 2N - it will only
occur once, as 2p would be bigger than n. So if there is a prime
in N+1 ... 2N, (2N)! is not a sqare.

Bertrand's postulate tells you almost exactly that - there is always
a prime in N+1 ... 2N-1 (for N>1).

You can easily see it works for odd n too.

-- Richard

Richard Heathfield

unread,
Jul 27, 2022, 6:03:41 PM7/27/22
to
On 27/07/2022 9:19 pm, Richard Tobin wrote:
> In article <tbphev$25ufh$1...@dont-email.me>,
> Richard Heathfield <r...@cpax.org.uk> wrote:
>
>>> For n>1, n! is never a square. This follows trivially [walks away,
>>> returns a couple of minutes later], yes trivially, from Bertrand's
>>> postulate.
>
>> I have a truly marvelous proof of Mr Tobin's statement, which
>> Usenet is too narrow to contain.
>
> The basic idea is simple: any prime factor of a square must occur
> twice (or 4 times, or 6 ...).

You're a sly old fox, sir.

Richard Tobin

unread,
Jul 28, 2022, 7:50:03 AM7/28/22
to
>Why is a (factorial) rarely a square ?
>
>Why is a (factorial - 1) rarely a square ?
>
>Why is a (factorial + 1) rarely a square ?

Ignoring the proof that n! is never square for n>1, what would
we expect?

Since the gap between (n-1)^2 and n^2 is 2n-1, and the gap between n^2
and (n+1)^2 is 2n+1, we can say in a hand-wavy sort of way that the
probability of k being a square is 1 / 2sqrt(k).

So in a similarly rigorous manner we can say that the expected number
of factorials (>1!) that are squares is

1 / 2 sqrt(2!) + 1 / 2 sqrt(3!) + ...

The denominators go up much faster than n^(any fixed power), and even
sum 1/n^2 is finite and small, so this will converge to a small number
- less than 2 in fact. So on purely statistical grounds we would
expect only a finite, small number of square factorials, and the same
goes for n! +/- 1.

-- Richard

henh...@gmail.com

unread,
Jul 28, 2022, 1:39:52 PM7/28/22
to
thanks!


Bertrand's postulate states that there is a prime p between n and 2n ( for n > 2 ).

-------------- ( for n > 2 ) ... <--- this doesn't seem right



Why is a (factorial - 1) rarely a square ? ------- i'm guessing that this one is much easier to show than Bertrand's postulate


Why is a (factorial + 1) rarely a square ? ----------- e.g. ( 4 ! + 1 ) = 25 = 5*5, 11^2, 71^2

0 new messages