gpt4 book ai didi

list - Ocaml:函数无法返回完整的结果列表

转载 作者:行者123 更新时间:2023-12-02 06:57:13 24 4
gpt4 key购买 nike

我正在研究这个 site 中的问题,其中一个问题是要求在给定范围内返回哥德巴赫猜想。

我的答案适用于小范围,但对于大范围(例如 2 - 2000),它只返回部分解决方案,如下所示:

[(2, (2, 0)); (4, (2, 2)); (6, (3, 3)); (8, (3, 5)); (10, (3, 7));
(12, (5, 7)); (14, (3, 11)); (16, (3, 13)); (18, (5, 13)); (20, (3, 17));
(22, (3, 19)); (24, (5, 19)); (26, (3, 23)); (28, (5, 23)); (30, (7, 23));
(32, (3, 29)); (34, (3, 31)); (36, (5, 31)); (38, (7, 31)); (40, (3, 37));
(42, (5, 37)); (44, (3, 41)); (46, (3, 43)); (48, (5, 43)); (50, (3, 47));
(52, (5, 47)); (54, (7, 47)); (56, (3, 53)); (58, (5, 53)); (60, (7, 53));
(62, (3, 59)); (64, (3, 61)); (66, (5, 61)); (68, (7, 61)); (70, (3, 67));
(72, (5, 67)); (74, (3, 71)); (76, (3, 73)); (78, (5, 73)); (80, (7, 73));
(82, (3, 79)); (84, (5, 79)); (86, (3, 83)); (88, (5, 83)); (90, (7, 83));
(92, (3, 89)); (94, (5, 89)); (96, (7, 89)); (98, (9, 89)); (100, (3, 97));
(102, (5, 97)); (104, (3, 101)); (106, (3, 103)); (108, (5, 103));
(110, (3, 107)); (112, (3, 109)); (114, (5, 109)); (116, (3, 113));
(118, (5, 113)); (120, (7, ...)); ...]

我尝试使用网站提供的解决方案,但同样的事情发生了。我想知道是否有办法返回完整的解决方案列表。

谢谢!

最佳答案

我认为您的意思是顶层仅显示列表的前缀。您可以通过编写自己的代码来显示列表来解决此问题。

像这样的东西会起作用:

let p (a, (b, c)) = Printf.printf "(%d, (%d, %d))\n" a b c

let printMyList l = List.iter p l

关于list - Ocaml:函数无法返回完整的结果列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28950843/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com